What is best practice for WP with regard to using loop.php (loop-single.php, etc) versus looping inside the template file? Does it matter with regard to efficiency or ?

2 Answers 2


Depends on whether you would use that single-loop in more places. If you're only using it in one place and that will remain the case, do it within single.php, if you're going to be reusing it elsewhere, I'd highly suggest using a single-loop template part.

  • Ok. The idea being if it's a loop that will be utilized in many places put it in a separate loop file for central access. Thanks brotha!
    – Devise
    Sep 22, 2011 at 13:52
  • JDV, I also just noticed that WP's default TwentyTen theme uses separate loop files, and TwentyEleven does not. This confused me to a degree .. any short idea on what their thinking was with dropping the loop files?
    – Devise
    Sep 22, 2011 at 14:00
  • To be honest, I don't know their thinking. I know I use a system of different custom post types, and I use the snippets to make it easy to make, for instance, search result pages or other custom listings. What I do is use a theme partial that has the post_types name in it, so I do this: get_template_part( 'partials/loop' ); And then in that loop partial, I do this: while ( have_posts() ) : the_post(); get_template_part( '/partials/short', $post->post_type ); endwhile; // End the loop. This makes it very easy for me to make changes to the loop and add CPT's... Sep 26, 2011 at 12:24

No, it's just a Q of organizing your theme files. It's template vs. template part. Later will do some searching inside your parent & child theme and then include your template part, but that doesn't do much perfomanze decrease.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .