I can't figure out why I'm getting an infinite blog post. When I comment out loop code in content.php, it no longer loops. I'm trying to post items based on post format and failing so far. Let me know if I need to provide anymore info! I appreciate it.


 * The default template for displaying content. Used for both single and index/archive/search.
 * @subpackage FoundationPress
 * @since FoundationPress 1.0

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <?php FoundationPress_entry_meta(); ?>

    <div class="entry-content">
        <?php the_content(__('Continue reading...', 'FoundationPress')); ?>

        <?php if ( have_posts() ) : ?>

        <?php do_action('foundationPress_before_content'); ?>

        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>

        <?php else : ?>

            <?php get_template_part( 'content', 'none' ); ?>

        <?php do_action('foundationPress_before_pagination'); ?>
    <?php endif;?>

        <?php $tag = get_the_tags(); if (!$tag) { } else { ?><p><?php the_tags(); ?></p><?php } ?>
    <hr />

1 Answer 1


Your file is named content.php, and this line:

get_template_part( 'content', get_post_format() );

will load the same file for posts with standard post format, causing your down-the-rabbit-hole loop.

  • I'm trying have it call content-gallery.php or content-quote.php. Do I still take that loop out of content.php? Thanks for the reply!
    – Waymond
    Jul 18, 2014 at 1:41
  • the issue is that get_post_format() is empty for posts that are standard format, so you're loading content.php inside content.php, which then loads content.php, etc., in an infinite loop. you should rename the above content.php to something else if you want to use this structure.
    – Milo
    Jul 18, 2014 at 1:55
  • Thank you for the explanation. Going to dive deeper into it.
    – Waymond
    Jul 18, 2014 at 2:27

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.