This tutorial provides different ways to customize, modify and filter the featured image ( post_thumbnail ) attached to the 1st post in the home page loop.
This solution uses the genesis_get_image_default_args filter therefore only works on Genesis.
It also uses the_post_thumbnail function which works in any theme and enables you to filter the size and any of the wp_get_attachment_image attributes.
Here’s some sample CSS which only changes the style of the first featured image in the loop.
.first-image {
border: 5px red solid;
}
Only Add Class On 1st Page
The following code only adds the custom class to the first featured image on the 1st page of the archive unlike the first snippet which adds it to the first post on each paginated page of the home page archive:
This tutorial is based on this question:
I’m trying to create a bit of code to put into functions.php that will change the size of the featured image only on the first post on the first page.
Leave a Reply
You must be logged in to post a comment.