Title: query_posts: display all categories
Last modified: August 22, 2016

---

# query_posts: display all categories

 *  [matidiaz00](https://wordpress.org/support/users/matidiaz00/)
 * (@matidiaz00)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/query_posts-display-all-categories/)
 * Create a code to show all post of each of my categories:
 *     ```
       <li>
           <a>La Boca</a>
           <ul class="sub-menu">
               <?php
               query_posts( array ( 'category_name' => 'La Boca', 'orderby' =>         'menu_order', 'order' => 'ASC', 'showposts' => -1 ) );
               while ( have_posts() ) : the_post(); ?>
               <li>
                   <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
               </li>
               <?php endwhile;wp_reset_query();?>
           </ul>
       </li>
       ```
   
 * The problem with this code is that I have to be repeated for each of the categories,
   there is a way for all categories will be automatically loaded? for example with
   a variable where it says “category_name”?
 * Thanks for the help

The topic ‘query_posts: display all categories’ is closed to new replies.

## Tags

 * [all categories](https://wordpress.org/support/topic-tag/all-categories/)
 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * 0 replies
 * 1 participant
 * Last reply from: [matidiaz00](https://wordpress.org/support/users/matidiaz00/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/query_posts-display-all-categories/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
