• Hi,
    I am trying to display posts of only certain category on a page, for which I have made a template and assigned it to that page from the page template selector.
    However the page simply uses index.php instead.

    This page is assigned as the default posts page.

    If I try to insert a conditional in the index page to identify the page and display only one category for that page, it does not work either.
    The code is as below:

    <?php  if (is_page('18'))
    {query_posts('cat=3');} ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h3><?php the_title(); ?></h3>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page &raquo;
    '); ?>
    </div>
    </div>
    <?php endwhile; endif; ?>

    This however works if I remove the conditional, (but on all pages, not just the one I want)

    * Some part of the code lines on the right does not appear here – don’t know why…

  • The topic ‘page reverts to index.php template instead of assigned’ is closed to new replies.