[Resolved] How do I suppress the featured image for all posts of a category (and children)

Home Forums Support How do I suppress the featured image for all posts of a category (and children)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1051875
    Sara

    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!

    #1051889
    Purushottam

    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;
    }

    #1051894
    Sara

    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)

    #1051900
    David
    Staff
    Customer Support

    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

    #1051904
    Sara

    Thanks. How do I apply this layout element to all posts in a category (and its children categories)?

    #1051907
    David
    Staff
    Customer Support

    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.

    #1051920
    Sara

    Thank you. It’s not that many categories, so I’ll add them all manually. This was very helpful!

    #1051926
    David
    Staff
    Customer Support
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.