Archived topic
Show Featured Image on Category Listing Page, not on Post Page
4 replies · Started by Jeffrey on August 18, 2020
Hello,
I have a site where I am trying to show a list of posts from a specific category. Each post has video content in the post, but I only want the featured image to show up on the category list. When someone clicks the featured image or the title of the post, I would like it to take them to the post page, but on the post page, I don't want the featured image to show up, I only want the actual video content to show up. Is it possible to hide the video when doing the category list, and just show the featured image instead? Also, is it possible to completely hide the featured image on the actual post when someone clicks on the post?
Hi there,
You can use the customizer option to turn off the featured image in the main posts page:
https://docs.generatepress.com/article/adjusting-the-featured-images/
Then display it on category archives with this filter:
add_filter( 'option_generate_blog_settings', function( $options ) {
if ( is_category() ) {
$options['post_image'] = true;
}
return $options;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Hi Leo,
When I use Code Snippets to add that code to my site, the site becomes completely inaccessible. Is there anything more that I have to do to get that code snippet to function properly?
Hi there,
that code tested fine with me
Can you make sure it copied across correctly. things as simple as slanty single quotes can break a code.
Hi Jeffrey,
Were you able to resolve this?
I randomly found a mistake in the code and have edited it.
Sorry about that!