query_posts in index.php is working, but single.php is NOT!!! help (2 posts)

  1. mo2007
    Posted 7 years ago #

    I have 3 sections of my website that use the query_posts:

    <?php $posts = query_posts( "cat=8&showposts=1"); ?> <?php if( $posts ) : ?>
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>

    what I needed appears on the front page. I also use it for my index.php to exclude posts that belong to certain categories that I don't want to show, the problem is, how do I create my single.php

    I tried copying everything in index.php and pasting it into single.php, but nothing happens. I have put <?php wp_reset_query(); ?> at the end of all the 3 queries....nothing :(

    and btw...those 3 queries are in the header.php and not in the single.php which makes single.php file have only one query_posts

    any help would be appreciated..thanx in advance

  2. wp_guy
    Posted 7 years ago #


    <?php query_posts($query_string); ?>

    and then the regular loop.

    Good luck!

Topic Closed

This topic has been closed to new replies.

About this Topic