Archived topic
How do I suppress the featured image for all posts of a category (and children)
7 replies · Started by Sara on November 3, 2019
If a post belongs to a specific category (and all its child categories) - then I don't want to display the featured image.
How do I accomplish that?
Thanks in advance!
I would create a header with the featured element's selector and display them on the particular categories you wish to hide images on.
Would look something like this:
.featured-image img
{
Display:none;
}
I'm sorry - I don't understand what you wrote here. Please note that I'm looking to suppress featured images on the posts that belong to those categories (not on the category archives themselves)
Hi there,
you can use the Layout Element to Disable Featured image:
https://docs.generatepress.com/article/layout-element-overview/
You can set the Display Rule Locations for each of the Post Categories you want to remove the image from
Thanks. How do I apply this layout element to all posts in a category (and its children categories)?
Unless the child categories also have the parent term checked, currently using the Layout Element you would need to add a Display Rule Location: Post Category > Category Term for the parent and each of the child categories. Just add as may locations as required.
We're looking at adding this option to the Display Rules in a later update.
How many child categories are there? If theres a lot or they will be updated regularly we can look at some code to do this.
Thank you. It's not that many categories, so I'll add them all manually. This was very helpful!
You're welcome