Support » Fixing WordPress » 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)
  • <?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

    (@nickkos)

    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.