Hide Featured Images for especific posts and pages

  • Author
    Posts
  • #164244

    letrasypoesiaes
    Member
    Original poster

    This is the thing:

    Situation 1: I created a customized Home page in which I use a widget that shows posts and pages following certain tags or categories.

    Situation 2: In some pages I dont need Featured Images because I use already the principal image in the body of the post. However, when I am in the home page or search some keyword and appears the list of posts, these posts preview image is white, because it dont have Featured Image. The idea is it shows the image of the body.

    Posible solution: I know I can activate or deactived Featured Image view in Customization, however only works in a general way, no for especific posts. If I deactive that view, so that hide the featured Image in the posts, but the Home page described in the Situation 1 also hide the images.

    I need some CSS code or styling to be able to add a featured image that appears on the home page, but hides when I open that post.

    The blog I need help with is: letrasypoesia.com

    #164245

    tarasdashkevych
    Theme Author

    Hello,
    Thank you for providing a descriptive information about the issue you are trying to solve on your site.

    I can see that your homepage is consisted of two sections which displays posts/pages:

    (1) “Nuestros escritores”
    (2) “Últimos escritos”
    (3) “Letras & Poesía Slam”

    Since the first section (“Nuestros escritores”) displays child pages of the “Escritores” page, you can use this custom CSS to hide the featured image for all child pages of that parent page:

    
    .parent-pageid-65895 .featured-image-wrap {
      display: none;
    }
    

    Where 65895 is ID of the parent page. Here is a quick guide on how to find the page ID in WordPress: https://wordpress.com/support/pages/#how-to-find-the-page-id

    So, you can apply the same technique to the 3rd section. Here is a custom CSS for that:

    
    .parent-pageid-66013 .featured-image-wrap {
      display: none;
    }
    

    For the 2nd section (“Últimos escritos”), you can use this custom CSS to hide the featured image in singular post views:

    
    .single-post .featured-image-wrap {
      display: none;
    }
    

    However, this change will affect all posts on your site.

    Hope this helps. Please let me know if you have any additional questions.

    Kind regards,
    Taras

    #164246

    letrasypoesiaes
    Member
    Original poster

    Wow. It works! Just the way I needed. Thank you very much!

    #164247

    tarasdashkevych
    Theme Author

    You are very welcome :)

    Kind regards,
    Taras

The topic ‘Hide Featured Images for especific posts and pages’ is closed to new replies.