Output The Featured Image in a Loop as a Linked Media Image

Feature Image Loop

Instead of linking a featured image to a post permalink in a loop – here is how you can link to its original image of itself. <?php // Create the variable for the large image src link $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘large’ ); // Out the Post Title Using the post permalink for the post…

Read More

Add The Title Attribute To Featured Image in WordPress


The title attribute for the WordPress featured post has been removed for a while, but you can get it back with the wp_get_attachment_image_attributes filter which can add the HTML attribute markup back in, add to your functions.php file…   add_filter( ‘wp_get_attachment_image_attributes’, ‘tl_add_img_title’, 10, 2 ); // Add title attribute to featured image function tl_add_img_title( $attr, $attachment…

Read More