WordPress.org

Ready to get started?Download WordPress

Forums

Problem with query_posts and is_home if statement. (2 posts)

  1. pearldesigndub
    Member
    Posted 2 years ago #

    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!

    AB

  2. pearldesigndub
    Member
    Posted 2 years ago #

    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....

Topic Closed

This topic has been closed to new replies.

About this Topic