Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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"

<?php
/**
 * @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') ?>     
</div>
<?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:

<?php
//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>
        </div>
    <?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'); ?>
        </div>
        <?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
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.