How To Display the Featured Image on a Single Post in WordPress Only for a Specific Category

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
add_action( 'genesis_entry_content', 'featured_post_image', 8 ); function featured_post_image() { $categories = get_the_category(); foreach ($categories as $category) { // You can use slug, ID or any other identifier from the WP_Object //if ($category->term_id == 288) { if ($category->slug == 'your-slug-here') { print '<div id="sub-header-image">'; the_post_thumbnail('post-image'); print '</div>'; } } return; } |
Leave Your Comment
All fields marked with "*" are required.