WordPress theme code – Duplicate Featured Image on Post and HomePage Fix

wordpress-logo_s

I was working on a project and I added a featured image to the post. There was also an image in the post directly (in the single page view — single.php). So low and behold when I went to the homepage I saw the featured image display perfectly how I wanted and then BAM! the same image right next to it. WHY??? Well I didn’t have anything that told wordpress to display the featured image on the home/archive/category page ONLY and not the images in the post!!!

Until now…

Here’s the code snippet to prevent post images from displaying on the homepage:

[code]
add_filter(‘the_content’,’wpi_image_content_filter’,11);

function wpi_image_content_filter($content){

[/crayon]

}
[/code]

Add that to your functions.php file and you should be good to go!

from
http://surefirewebservices.com/wordpress/wp-snippet-duplicate-featured-image-on-post-and-homepage