Site logo

Archived topic

Hide featured image on posts of a special category

3 replies · Started by xdaniel on October 1, 2016

Viewing posts 1–4 of 4

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

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 :)

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/

Awesome :) Glad I could help!

This archived topic is closed to new replies.