Why aren’t my posts/pages showing up in my WordPress Theme?

i built a custom wordpress theme, and for some reason don’t know why the posts/pages are not showing up in the theme, but they show up in all other themes. Here is the index.php code:

<?php get_header( ); ?>         
<div id = "contentwrapper"> 
<div id = "content" role = "main">
    <div id = "leftcolumn">

        <?php if ( have_posts() ) : ?>
            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <?php get_template_part( 'content', 'page' ); ?>
            <?php endwhile; ?>
            <?php twentyeleven_content_nav( 'nav-below' ); ?>
        <?php endif; ?> 
        <div id = "locationimageslider">
        </div>  
        <div id = "locations"> 
            <div class = "location" name = "loc1">
                <p class = "title"> Cafe Coyote </p>
                <p class = "phone"> (619)291-4695 </p>
                <p class = "description"> <span>3:30PM to 6PM:    </span>  $2 tacos, $3 beers & $4 margaritas. </p>
                <div id = "ratings">
                </div> 
                <div id = "imthere">
                </div>  
            </div>  
            <div class = "location" name = "loc1">
                <p class = "title"> Cafe Coyote </p>
                <p class = "phone"> (619)291-4695 </p>
                <p class = "description"> <span>3:30PM to 6PM:    </span>  $2 tacos, $3 beers & $4 margaritas. </p>
                <div id = "ratings">
                </div> 
                <div id = "imthere">
                </div> 
            </div>
        </div>
    </div>
    <?php get_sidebar( ); ?>
</div>  
</div> 
<?php get_footer( ); ?>
</body>
</html>

here is the page.php code:

<?php get_header( ); ?>         
<div id = "contentwrapper"> 
<div id = "content" role = "main">
    <?php the_post(); ?>
    <?php get_template_part( 'content', 'page' ); ?>
    <?php get_sidebar( ); ?>
</div>  
</div> 
<?php get_footer( ); ?>
</body>
</html>

Related posts

Leave a Reply

2 comments

  1. Try this basic template layout

    <?php
        get_header();                           # gets header.php contents
    
        if (have_posts()):                      # checks if there are any post available for this url
            while(have_posts()):                # starts loop
                the_post();                     # assigns $posts global
    
                the_title();                    # outputs post title
                the_content();                  # outputs post content
            endwhile;                           # ends loop
        endif;                                  # ends conditional check
    
        get_footer();                           # gets footer.php contents
    
  2. In both index.php and page.php, you’re calling:

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

    Does your Theme have content-page.php or content.php files?

    (Note: you should probably be using a content.php file in index.php, and call get_template_part( 'content' ).

    In page.php, you’re not calling the Loop properly. You have:

    <?php the_post(); ?>
    

    …instead of:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    

    That may or may not cause a problem.