Title: How Does Category Query Work?
Last modified: August 20, 2016

---

# How Does Category Query Work?

 *  [nickkos](https://wordpress.org/support/users/nickkos/)
 * (@nickkos)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/how-does-category-query-work/)
 * Okay so let me explain what Im trying to do, I am trying to make it so that my
   custom post type “Employees” which has categories enabled uses a dynamic category
   page that only lists posts within the current category that you are on.
 * its like a wp_query for custom post type & catid but catid = current category
   that your on.
 * I cannot for the life of me understand how the category query works. I’ve looked
   in countless normal themes and all that I find is a loop.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [oritzio](https://wordpress.org/support/users/oritzio/)
 * (@oritzio)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/how-does-category-query-work/#post-3227204)
 *     ```
       <?php query_posts('cat=3&showposts=10&order=DESC');?>
       <?php while (have_posts()) : the_post();?> 
   
       	<?php the_title(); ?>
       	<?php the_content(); ?>
   
       <?php endwhile; ?>
       ```
   
 * you can use this code, it will give you 10 posts from category 3
    how do you 
   know what’s your category ID, you need to go in the admin panel to Posts > Categories
   click on the category name then look at the address bar link in the browser, 
   you should see something like:
 * wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=3&post_type=post
 * do you see ID=3?
 *  Thread Starter [nickkos](https://wordpress.org/support/users/nickkos/)
 * (@nickkos)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/how-does-category-query-work/#post-3227217)
 * Not exactly what I’m going for…I want it to be dynamic…so I want that cat=3 to
   always = the pages cat id that your are on.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How Does Category Query Work?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [nickkos](https://wordpress.org/support/users/nickkos/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/how-does-category-query-work/#post-3227217)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
