Exclude Post Category
-
Hello,
I have a custom post type called woo_video and categories called woo_video_categories. Many of the videos are listed under multiple categories. I would like to control what videos are shown by using a category (so either excluding one particular category or including a particular category. for example: ‘Exclude from Home’ or ‘Include in Home’). I believe that I am able to find the category ID (and the ID I was trying to exclude was 51). I have tried:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$args = array( ‘post_type’ => ‘woo_video’, ‘posts_per_page’ => 9, ‘woo_video_category’ => -51 );And:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$args = array( ‘post_type’ => ‘woo_video’, ‘posts_per_page’ => 9, ‘cat’ => -51 );And:
<?php query_posts($query_string . ‘&cat=-51’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>And:
<?php query_posts($query_string . ‘&woo_video_category=-51’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>I have also tried the ‘category__not_in’ command. Nothing seems to work.
Any idea what I am doing wrong? Is it because the videos fall into multiple categories? I would like to exclude category ID 51 even if other categories are assigned. As stated above, I am also open to a loop that includes all that fall under a specific category.
Thank you in advance!
The topic ‘Exclude Post Category’ is closed to new replies.