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 am a fairly experienced OpenMP user, but I have just run into a
I have plenty of experience with this in PHP, but am fairly new to
Fairly simple question: I have an init method on my class that has the
I'm a fairly experienced .NET desktop developer, but I'm new to Silverlight. I'm trying
I'm fairly new to Silverlight but experienced in web development, and I'm finding myself
I'm a fairly experienced web developer, but I've never needed to work with video
I'm a fairly experienced Java user, but I've just started trying to use NetBeans
I am a fairly experienced (mid-level) developer that has spent quite a bit of
I am fairly experienced with regular expressions, but I am having some difficulty with
I am new to Symfony+Doctrine, but fairly experienced with web application development in general

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.