• I’m trying to have only posts from the category “news” being posted on my main page. I’ve been using qurey_posts for the WP 1~1.5 but since upgrading to WP 2.0 it stoped working, and I kept on getting an endless loop.
    here’s what I used:

    <?php query_posts(“category_name=news&showposts=1”); ?>
    <!– followed by a loop ->

    it used to work, but not anymore. could anyone help me out here? I’m really stuck here… thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • See this thread (I suspect you have the same problem):

    https://www.ads-software.com/support/topic/53272

    Quick answer: Use the cat parameter with the numeric category ID:

    <?php query_posts("cat=10&showposts=1"); ?>

    *or* provide the full hierarchy for the category:

    <?php query_posts("category_name=cat-parent/news&showposts=1"); ?>

    Thread Starter tommyhilfiga

    (@tommyhilfiga)

    Kafkaesqui thanks a lot!! I really do appreciate it.

    <?php query_posts(“cat=10&showposts=1”); ?>
    didn’t work. I got my usual endless loop.
    but <?php query_posts(“category_name=cat-parent/news&showposts=1”); ?> worked like a charm

    Thanks again!!

    PS. I did search for older posts before posting but, I couldn’t find anything… will try to search harder next time!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP 2.0 and query_posts’ is closed to new replies.