Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4069102
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:27:32+00:00 2026-05-20T16:27:32+00:00

I am fairly experienced with creating custom WordPress loops and such, but I have

  • 0

I am fairly experienced with creating custom WordPress loops and such, but I have a requirement now that I need assistance on.

I need to create a WordPress loop that displays posts from all categories (that parts easy 🙂 ) however, each category needs to be encased in a DIV with a unique class and ID, with all of the posts for that category shown in that DIV. This needs to happen to all categories, no matter how many there are, and no matter if new ones are added or old ones are removed.

If anyone can help me with this or provide an example, that would be grand 🙂

Thanks so much
Zach

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:27:32+00:00Added an answer on May 20, 2026 at 4:27 pm

    You can get the desired categories by doing:

    <?php $categories = get_categories( $args ); ?>
    

    Documentation here.

    Then you can loop within $categories, using query_posts create your <div> and do whatever you want with it. (including fetching all the posts that belongs to that category)

    Those two links I gave you should be enough. But here is some pseudo code of what you may do:

    $categories = get_categories( $args );
    while($c in $categories):
        $posts = query_posts($c); 
        while($p in $posts):    
            <div></div>
        endwhile;
    endwhile;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly small MySQL database (a Textpattern install) on a server that
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and
I'm still fairly new to T-SQL and SQL 2005. I need to import a
I am fairly comfortable with standalone Java app development, but will soon be working
This is a fairly trivial matter, but I'm curious to hear people's opinions on
I'm fairly new to the world of versioning but would like to introduce Subversion
I am fairly new to Emacs and I have been trying to figure out
Being fairly new to JavaScript, I'm unable to discern when to use each of
I'm fairly new to ASP.NET and trying to learn how things are done. I
I'm fairly new to the STL, so I was wondering whether there are any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.