[Resolved] Hide featured image on posts of a special category

Home Forums Support [Resolved] Hide featured image on posts of a special category

Home Forums Support Hide featured image on posts of a special category

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #230972
    xdaniel

    Hello Tom,

    tried to find a solution in the forum, but had no success. Maybe you know a short snippet.

    What I want is,
    – to hide the featured image of a post
    – in a special category (for example videos)
    – on the post page and
    – not on the categorys page.

    Any idea?

    Best wishes

    Daniel

    #231012
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    1. Of a single post, you can use the Simple CSS plugin with the metabox:

    .page-header-image-single {
        display: none;
    }

    2. You’ll need to add a function to add the category class to the single post: https://generatepress.com/forums/topic/showhide-element-per-category/#post-146595

    Then you can do this:

    .category-videos.single .page-header-image-single {
        display: none;
    }

    3. This should do it:

    .archive:not(.category) .post-image {
        display: none;
    }

    Hope this helps ๐Ÿ™‚

    #231030
    xdaniel

    That worked Tom, thanks a lot. I used 2) with a little modification:

    .category-videos  .page-header-image-single {
        display: none;
    }

    I use this in a scenario of posting videos from youtube. A plugin generates an automatic featured image, but it is doubled on the single page with the preview of the video.

    See it in action here: https://celtic-rock.de/category/video/

    #231101
    Tom
    Lead Developer
    Lead Developer

    Awesome ๐Ÿ™‚ Glad I could help!

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