Get a free trial // Grow your CSS skills // Land your dream job

Multiple Loops in Category pages in WordPress

  • # April 24, 2013 at 8:26 am


    I was looking at this bit of code -> and specically step 4.

    Now that’s perfect for what I want to achieve for my home page of articles, but I want to also use multiple loops on each category page too.

    How can I do that?


    # April 24, 2013 at 10:44 am

    Just add category parameters to the queries.

    [Check Here]( “Check Here”)
    Under “Category Parameters”

    # April 24, 2013 at 2:33 pm

    what if I don’t know the category id?

    # April 24, 2013 at 4:49 pm

    category_name using the slug not good enough ?

    # April 24, 2013 at 5:45 pm

    Sorry, I’m just confused as to what to put. WordPress is still pretty heavy going for me.

    Do I add it to query_posts(); code?

    # April 25, 2013 at 10:27 am

    That would be correct. Something like

    < ?php query_posts('showposts=5&category_name=my-category-slug'); ?>

    # April 25, 2013 at 2:24 pm

    Right, suppose my next question is, how do I make the my-category-slug dynamic?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed