WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my main loop (loop-entry.php) pulling to my index page which is my homepage on this site: http://snippetmagazine.com/ when I tried to copy that loop and create (loop-blog.php) and included it on this page: http://snippetmagazine.com/blog with a custom page template nothing will pull.

Here is the page template for the "inner page"

 * @package WordPress
 * @subpackage portabellopixie Theme
 * Template Name: Blog
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<div id="index" class="post clearfix">
    <?php get_template_part( 'loop', 'blog') ?>     
<?php get_sidebar(); ?>
<?php pagination(); ?>
<a href="/want-to-sew-start-here"><img src="<?php bloginfo('template_directory'); ?>/images/sew.png" alt="" /></a><a href=""><img src="<?php bloginfo('template_directory'); ?>/images/classes.png" alt="" /></a><a href="/smart-start-art"><img src="<?php bloginfo('template_directory'); ?>/images/start_art.png" alt="" /></a>
<?php endif; ?>
<?php get_footer(); ?>

My loop for both pages looks like this:

//design for pages
if ( get_post_type() == 'page') { ?>

    <div class="loop-entry clearfix <?php if($count =='2') { echo 'remove-margin'; } ?>">
        <h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <?php the_excerpt(); ?>
    </div><!-- END entry -->

<?php } else { ?>
<div class="loop-entry clearfix <?php if($count =='2') { echo 'remove-margin'; } ?>">

    <?php if ( has_post_thumbnail() ) {  ?>
        <div class="loop-entry-thumbnail">
            <a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('post-image'); ?></a>
    <?php } ?>

        <h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <div class="post-meta">
        <?php _e('Posted On','portabellopixie'); ?> <?php the_time('j'); ?> <?php the_time('M'); ?>, <?php the_time('Y'); ?> - <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?>
        <?php the_excerpt(''); ?>

</div><!-- END entry -->

<?php } ?>

<?php if($count =='2') { echo '<div class="clear"></div>'; $count=0; } endwhile; ?>
share|improve this question
How is your site set up? In the Settings > Reading panel in the admin, have you defined your home page to be a static page, and the Posts page as /blog/? – Pat J Apr 16 '13 at 15:57
is that the full and correct code of the loop-blog.php? I don't see the while( have_posts() ) part ... also, in a page template, you need to tell the loop what to show, by adding a query. review codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates – Michael Apr 16 '13 at 17:16
This is in the loop: <?php $count=0; while (have_posts()) : the_post(); $count++; ?> – drewrowalnd Apr 16 '13 at 19:16
Pat, the homepage is set to show recent posts, but I also want to show those posts on the /blog/ page. – drewrowalnd Apr 16 '13 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.