I have my blog page here on a website I created, however I'm not understanding quite where to find the code to get rid of the images on my child theme. I'm using code from Twenty Ten and have set my own BLOG template page up but it's not working so I'm obviously editing the wrong file.

So isn't loop.php the file I'd want to edit to take out these images on the main blog page?

<?php /* How to display all other posts. */ ?>

    <?php else : ?>
        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
            <div class="entry-summary">
                <?php the_excerpt(); ?>
            </div><!-- .entry-summary -->
    <?php else : ?>
            <div class="entry-content">
                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
                <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
            </div><!-- .entry-content -->
    <?php endif; ?>

        </div><!-- #post-## --> 

But I don't know where it is that shows the images. These are just images I've added to the blog entries throughout the content.

Help is appreciated!

  • Are those featured images, or are they images in the content? If the latter, then you would have to either remove them from the page, add a filter to disable their display on the home page, or use the_excerpt() instead of the_content() (and it might be that the_excerpt() will still display the images).
    – Pat J
    Commented May 21, 2013 at 20:21
  • Assuming the latter (having re-read the question), I've posted an answer below.
    – Pat J
    Commented May 21, 2013 at 20:28

2 Answers 2


It sounds like you want to display only the excerpts on your blog home page. To do that, add is_home() to your conditional statement so that it looks like this:

<?php if ( is_archive() || is_search() || is_home() ) : // Only display excerpts for archives, search and blog home page. ?>

You can read more about what is_home() does here.

  • Pat J's answer is better if you want to keep the full content of each entry visible on your blog's home page.
    – Burgon
    Commented May 21, 2013 at 20:30
  • 1
    Also, per the codex, the_excerpt() strips out any HTML tags and graphics.
    – Burgon
    Commented May 21, 2013 at 20:34
  • Yes, I just re-read the Codex page and saw that it strips out HTML & graphics. Must try to remember that...
    – Pat J
    Commented May 21, 2013 at 20:36
  • Thnaks for the feedback Pat J and Burgon! I've been able to do what I need to do for the blog. It's just a simple/basic blog anyways so this is perfect! Thanks Burgon! I'll keep all this in mind for the next blog.
    – kia4567
    Commented May 21, 2013 at 21:44

If the images are part of the content of the page, you can try this:

add_filter( 'the_content', 'wpse100248_strip_images' );
function wpse100248_strip_images( $content ) {
    if( is_home() || is_front_page() ) {
        $find = '/<img [^>]*>/';
        $repl = '';
        $content = preg_replace( $find, $repl, $content);
    return $content;

This should remove <img ...> tags from the post/page content, but only on the site's front page or home page.


Codex: is_front_page() & is_home()
PHP's preg_replace()

  • 1
    Also: I personally would probably insert this code into the theme's functions.php, since it's about presentation, but have a look at this Q&A and follow your heart.
    – Pat J
    Commented May 21, 2013 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.