Support » Themes and Templates » Using query posts in seperate single.php templates

  • I’m working on a custom theme for my site and have set up 2 custom single.php templates. In both of the templates I’m using <?php query_posts(‘cat=ID’); ?> where ID is either the only category that I want or the category that I want to exclude.

    It’s working on the homepage, but the single.php template now just shows all the posts that match that criteria. Is there a way to do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ok, I think I’ve figured out most of it. What I’m basically trying to do is have one section of my site have only posts from one category and the rest of the categories in another section. I used the ‘Unique Single Template” hack from this page ( to split off the two sections.

    Category ID 3 is the one I want on it’s own and I have it working now by changing the default previous_post_link to the following <?php previous_post_link(<strong>Previous Entry</strong>%link', '%title', TRUE, ''); ?>.

    However, in the catch all template I have replaced the previous_post_link with <?php previous_post_link('<strong>Previous Article</strong>%link', '%title', FALSE, '3'); ?> but it’s not working and still linking to posts in category 3.

    What am I missing?

    Does anyone have any ideas why the previous_post_link isn’t restricting the category I have specified? I’ve tried everything I can think of and been all over the forums but have found nothing.

    <?php previous_post_link('<strong>Previous Article</strong>%link', '%title', FALSE, '3'); ?>

    I guess that instead of FALSE, you should have TRUE…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using query posts in seperate single.php templates’ is closed to new replies.