• I have a custom category page that is a for custom post types. I have the following code for the new wp query.

    <?php
    $paged = (get_query_var('page')) ? get_query_var('paged') :1;
    $featured = new WP_Query("cat=36&showposts=20&orderby=rand&post_type=business&paged=" . $paged); 
    
    	?>
    <?php if ($featured->have_posts()) :  ?>
    <?php while ($featured->have_posts()) : $featured->the_post(); ?>

    I have the cat id as 36 but this template needs to be used for multiple categories and I need code to get the category ID and then put it where the 36 is. How would I achieve this?

    Sincerely, Garret

Viewing 1 replies (of 1 total)
  • Hi

    Untested but I’ve used this sort of query before

    $featured = new WP_Query('cat='.get_query_var('cat').'&showposts=20&orderby=rand&post_type=business&paged=' . $paged);

    Kevin

Viewing 1 replies (of 1 total)
  • The topic ‘Getting Current Category Page ID into new wp query’ is closed to new replies.