• I have two templates. Each template has the exact same code to display a page. While one displays the page with the right content, the other displays, not a page, but the latest post. What could be wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • It kinds of sounds like the post is being called from single.php rather than your template. Are you sure you are writing a page and not a post?

    Thread Starter vern

    (@vern)

    Nope. It’s using page.php and not single.php.

    They cannot be exactly the same. One has to be named something else than page.php, plus the one called whateverpage.php has to have these lines at the top:
    <?php
    /*
    Template Name: Whatever
    */
    ?>

    Thread Starter vern

    (@vern)

    What I meant was two different themes that both have page.php. One template displays the page fine while the other displays the latest post.

    Hmm… I would check in the header.php of the second theme for some if statements… like if is_page or something.

    Thread Starter vern

    (@vern)

    Nope. Nothing.

    This is the code:


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

    Post Number: <?php the_ID(); ?>

    <div class="post"><!-- Post Div-->
    <h2 id="post-<?php the_ID(); ?>">
    " rel="bookmark"><?php the_title(); ?>
    </h2>
    <div class="entry">
    <?php the_content(__('(more...)')); ?>
    <?php link_pages('<p class="postmetadata">Pages:', '', 'number'); ?>
    </div>
    </div><!-- End of post div-->
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this page!', '', ''); ?>

    Anything in there that would be missing? or not needed?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page Template Not Displaying Page’ is closed to new replies.