Support » Themes and Templates » ‘Post Pages’ template being ignored?

  • Resolved indextwo

    (@indextwo)


    I’ve got a static page set as my front page, and *tried* setting a specific ‘Blog’ page as my Posts page, but the template I’ve chosen for this page is being ignored. So:

    – I go to Manage > Pages and have an empty Blog page, with the page template ‘Blog’ chosen (I’ve tried many variations; currently it’s a direct copy of the Default theme’s index page, with absolutely no alterations)

    – Then to Settings > Reading > select ‘Blog’ as my Posts Page

    All looks correct so far? With the Default theme switched on, a news post looks like this:

    <div class="post" id="post-1">
    <h2>First Post</h2>
    <small>August 15th, 2007 <!-- by admin --></small>

    <div class="entry">
    <p>Lorem ipsum this is a news post.</p>
    </div>

    <p class="postmetadata"> Posted in Default | Edit | 1 Comment »</p>
    </div>

    However, using my theme and my page with a template (or with no page/template selected), it simply displays this:

    <p>Lorem ipsum this is a news post.</p>

    The only reason I can think is that because my index.php is simply this:

    <?php get_header(); ?>

    <?php if (have_posts()) : ?>

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

    <?php the_content(); ?>

    <?php endwhile; ?>

    <?php else : ?>

    <h1>Not Found!</h1>
    <p>Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    …but none of that should apply if I’m choosing a specific page with a template selected, should it?

    I am literally tearing chunks of my hair out, so if anyone can help, that would be awesome.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    but the template I’ve chosen for this page is being ignored

    That’s correct, it will be. The blog page always uses the index.php. Period, full stop. The Page Template setting only applies when it’s actually showing a Page, not when you override the page to show the blog posts instead. All you really get when you assign the main blog to another page is that page’s URL, not its settings and content.

    This is done to keep the template meanings correct and consistent, the blog posts always use the Template Hierarchy, you can’t shove them into a Page hierarchy.

    WordPress will never choose a Page Template when it thinks that it is supposed to be showing Posts.

    I’ve just figured this out, but thanks for your quick response.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘‘Post Pages’ template being ignored?’ is closed to new replies.