• Hello,

    I’m trying to show a featured image on my homepage – a 200 x 200px thumbnail (a cropped version of the post’s main image). But, I want to hide any other images from showing on the home page.

    To clarify, my posts are short, and include images. How can I use the_content(); but not output images from within posts?

    I really hope someone can help me.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    replace the_content() with this (inside the loop):

    $content = strip_shortcodes($post->post_content);
     $content = str_replace(']]>', ']]>', $content);
     $content = strip_tags($content);
     $content = apply_filters('the_content', $content);
     echo $content;

    see post thumbnails to show the post thumbnail
    see set_post_thumbnail_size or see add_image_size to change the thumbnail size to a 200 x 200px thumbnail.

    Same issue: how to keep featured image and hide inserted graphics on the home page.

    Here’s a solution that worked for me.

    It involved changing one line of my theme’s home.php file from the_content() with the_excerpt().

    hope this helps,

    James

    Featured Images do not show up at the home page and on other places? Why?
    I am using WordPress as a CMS(Content Management System) for my site.
    I am not hosting my site on WordPress, instead on a .tk domain name.
    Whenever I write a post and select a featuring image, the image does not show up in the home page or in any other pages, while the post appears.
    What is the problem? Need Help?
    This is my site to see an example http://hackernews.tk/
    I am using a theme called “Reporter” from web2feel.com
    the theme site is http://www.web2feel.com/reporter/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Thumbnail on Home Page but hide post images’ is closed to new replies.