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 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>
share|improve this question
1  
are not showing up where? did you include a template name? are you using the loop in your template? I feel some details are left out. Please try to provide more details about what went wrong and what you've tried and I'll try to help. –  BandonRandon Oct 20 '11 at 6:14
add comment

2 Answers

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.