Hide Featured Image in Post in Twenty Fifteen

I'm using Twenty Fifteen as a parent theme. The only thing in child styles.css is the CSS I pasted below.

I want to have a Featured Image (FI) in posts, but not display it in the posts, so that e.g. the Related Posts plugin uses the FI for a thumbnail.

The problem is SPACING. I've hidden the FI via CSS, but I can't get the spacing to behave exactly as it does with no FI selected.

This is the CSS that works:

.post.has-post-thumbnail .post-thumbnail {
    display: none;
}
.single-post .attachment-post-thumbnail {
  display: none;
}
.post.has-post-thumbnail {
    padding-top: 4%;
}

I've adjusted padding-top, and I can get the hidden FI post to match the no FI post spacing for any one browser window size, but the spacing above the post title goes noticeably off with resizing, for example, from laptop to phone, the spacing increases.

I've tried removing twentyfifteen_post_thumbnail() from single.php, but that didn't solve it.

(Hope this isn't too specific and work for me for free-ish. If so, apologies!)

Topic theme-twenty-fifteen Wordpress

Category Web


I just had the same – or actually rather a similar problem. I wanted posts with and without FI to have the same top padding. I hope your problem has the same cause so that the following css could also work for your:

In Twenty Fifteen Parent style.css line 4448 the following is defined:

.hentry {
    padding-top: 8.3333%;
}

but in line 1582 however posts with a featured image are treated differently:

.hentry.has-post-thumbnail {
    padding-top: 0;
}

So in my child theme style.css I just applied the same top padding to both cases like this:

.hentry, 
.hentry.has-post-thumbnail {
    padding-top: 8.3333%;
}

I hope that will point you in the right direction

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.