Support » Themes and Templates » Problem with query_posts and is_home if statement.

  • Hi there ,

    Having an issue with query_posts stopping an is_home statement working.

    On my homepage I have a query_posts statement before the loop that displays only posts from a certain category ….

    <?php query_posts( 'cat=10' ); ?>

    Further down my index.php file I have a simple ‘is_home’ if statement that outputs some code if it is the homepage. However , this stops dead in its tracks when I use ‘query posts’ above . If I remove the query posts’ it works fine , but then I have every single post from every category outputted on my front page , when all I want are posts from a certain category. Any idea why this might be ?? Really tearing my hair out with this one!


Viewing 1 replies (of 1 total)
  • Made some progress with this.

    If you place a <?php wp_reset_query(); ?> statement before the ‘is_home’ if statement , it allows the ‘is_home’ to work. So I solved my initial problem. However , within the loop I’ve another ‘is_home’ statment that had stopped working , however should I use wp_query before this it knocks other ‘is_home’ statements out of joint, namely the query_posts statment at the beginning….

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with query_posts and is_home if statement.’ is closed to new replies.