Archived topic
Enabled Featured Image In Specific Category
3 replies · Started by Sam on August 26, 2018
Hi gents,
1. I have 2 categories (Podcast and Blog)
2. I don't want to display featured image in Blog page archive
3. I want to display featured image in Podcast page archive
4. I would like to find out how can you enable featured images in the Podcast archive page?
Have tried enabling featured images using GP Premium add on, but it seems to affect all archive pages.
Pretty sure there's a filter somewhere but I can't find it.
Please help, thank you so much!
Hi there,
Try this function:
add_filter( 'option_generate_blog_settings', function( $options ) {
if ( is_category( 'podcasts' ) ) {
$options['post_image'] = true;
}
return $options;
} );
Then you can turn the Customizer option off which will remove it from other archives.
The code above assumed the category slug is podcasts.
Hi Tom,
code worked beautifully, thank you.
Now there's another question (sorry to be a bother)
The Podcast Archive page currently shows this:
https://drive.google.com/file/d/1-IKVRSmN-gQ4wIDJhlRXSAw2qOoVtdDm/view?usp=sharing
But how can I shift the featured image (in Category Podcast) to above the blog post title?
Thank you very much!
Hi there, there is an option in the Customiser > Layout > Blog > Featured Images > Archive - Location
If that doesn't work on that post type then this article:
https://docs.generatepress.com/article/option_generate_blog_settings/#options-‘post_image_position’
It provides the additional option you can add to the code that Tom provided above.