[Support request] Show Featured Image on Category Listing Page, not on Post Page

Home Forums Support Show Featured Image on Category Listing Page, not on Post Page

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1408595
    Jeffrey

    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?

    #1408730
    Leo
    Staff
    Customer Support

    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/

    #1419720
    Jeffrey

    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?

    #1420129
    David
    Staff
    Customer Support

    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.

    #1441926
    Leo
    Staff
    Customer Support

    Hi Jeffrey,

    Were you able to resolve this?

    I randomly found a mistake in the code and have edited it.

    Sorry about that!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.