In Theme Blvd Framework 2.6, we introduced some new options for displaying the featured image prominently at the top of single post pages. Within the framework, we refer to this feature as “epic thumbnails” and in this tutorial, I’ll share a code snippet that’ll allow you to apply this to any custom post type.
In the following code snippet, it’s assumed that you’ve already registered two post types, foo
and bar
.
Now, there are two things happenning here — First, you need to filter the meta box that normally displays when editing posts, to display when editing your custom post types. And second, you need to filter onto a list of custom post types that are checked on the frontend before setting up the epic thumbnail.
/** * Display "Post Options" meta box when * editing custom post types, foo and bar. */ function my_post_meta( $setup ) { $setup['config']['page'][] = 'foo'; $setup['config']['page'][] = 'bar'; return $setup; } add_filter('themeblvd_post_meta', 'my_post_meta'); /** * Allow "epic thumbnail" to work on custom * post types, foo and bar. */ function my_epic_thumb_types( $post_types ) { $post_types[] = 'foo'; $post_types[] = 'bar'; return $post_types; } add_filter('themeblvd_epic_thumb_types', 'my_epic_thumb_types');