Ready to get started?Download WordPress


Looping through / Grouping by Sub-Categories (2 posts)

  1. DDeacon
    Posted 2 years ago #

    I have posts under the following category structure:

    -- Alaska (5 posts)
    -- Antarctica (2 posts)
    -- Arctic (0 posts)
    -- Asia (1 posts)
    etc. etc.

    I'm looking to create a custom loop that "loops" through all the sub-categories (under Destinations), displays the category name (if posts exist under that category - as a header), then the post titles under that category.

    Example of my expected code output:

       <li>Alaska post #1</li>
       <li>Alaska post #2</li>
       <li>Alaska post #3</li>
       <li>Alaska post #4</li>
       <li>Alaska post #5</li>
       <li>Antarctica post #1</li>
       <li>Antarctica post #2</li>
       <li>Asia post #1</li>

    I prefer to handle this via a loop and not another plug-in. Any assistance is much appreciated.


    — Dennis

  2. JudaZuk
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic