I believe I would have to ad or change something (probably in the array) in this bit of code?
if($my_post_type == CUSTOM_POST_TYPE1){ $my_post_cat = 'placecategory'; }else{ $my_post_cat = 'eventcategory'; } $args=array($my_post_cat => $category, 'post_type' => $my_post_type, 'posts_per_page' => $number, 'ignore_sticky_posts'=> 1); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { ?> <div id="loop" class="list clear"> <?php if($title){ ?> ........
is the "placecategory" and "eventcategory" the slug names for your categories?
If so try replacing
$my_post_cat => $category
With
'category_name' => $my_post_cat
Hi esquivelia,
If you want to exclude a category from the loop you would use something like the following instead
'cat' => -13
Where 13 is the category id.
To get the category id from the category slug do something like this
<?php $catObj = get_category_by_slug($my_post_cat); $catID = $catObj->term_id; ?>
So then the parameter for WP_Query would become:
'cat' => $catID
I believe I would have to ad or change something (probably in the array) in this bit of code?
is the "placecategory" and "eventcategory" the slug names for your categories?
If so try replacing
With
Hi esquivelia,
If you want to exclude a category from the loop you would use something like the following instead
Where 13 is the category id.
To get the category id from the category slug do something like this
So then the parameter for WP_Query would become: