susty
susty copied to clipboard
Disable feature images on homepage only?
Hi,
I'm using an adapted version of this theme for my blog, and I would like to use feature images on occasion. However, I've configured the theme to only have a list of post titles on the homepage, not the excerpt.
So I would like to have the feature image hidden on the homepage, but displayed when navigating to the actual post.
I imaging there's some jiggery pokery to be done in the template-tags.php
file, but I can't work out what it is.
If someone could help, I'd be ever so grateful.
Thanks!
I've been able to do this in CSS, but I would prefer is the image wasn't loaded in the first place if possible.
Just in case I don't get a response, this is how I did it with CSS:
body.home .attachment-post-thumbnail {
display: none;
}
You could wrap the featured image output behind a check against is_home
.
You could probably wrap the get_the_post_thumbnail
in template-tags
, specifically in here.
Something like this:
if(!is_home())
{ ?>
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
the_post_thumbnail( 'post-thumbnail', array(
'alt' => the_title_attribute( array(
'echo' => false,
) ),
) );
?>
</a>
<?php } ?>