WordPress.org

Support

Support » How-To and Troubleshooting » Why does this category / post_type combo not filter properly?

Why does this category / post_type combo not filter properly?

  • I am not sure why this is not working for me. I have a category, it is associated with a post_type, this is taken right out of the codex. It won’t filter. It just displays everything in the post_type.

    Suggestions please?

    Also my pagination is borked.

    Thank you.

    <?php // query
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$news = array(
    	'post_type' => 'news_listing',
    	'news_listing_category' => 'kids-news',
    	'order' => 'DESC',
    	'posts_per_page' => 10,
    	'paged' =>$paged
    	);
    ?>
    <?php query_posts($news); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    
    	<div class="post">
    
    		<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
    
    		<?php the_content(); ?>
    		<p class="metaP"><strong>Categories:</strong> <?php the_category(', ') ?>  | <strong>Tags:</strong> <?php the_tags(' ', ', ', ' '); ?></p>
    	</div>
    
    <?php endwhile; else: ?>
     <p><strong><?php include('inc/nope.php');?></strong></p>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    
    <a href="#top" class="moreUp">back to top</a>
    <?php include 'inc/postnav.php';?>
  • The topic ‘Why does this category / post_type combo not filter properly?’ is closed to new replies.
Skip to toolbar