I made a related post sidebar widget and im trying to exclude a category from it i tried 'exclude'=>7932 but that doesnt seem to work, is there another way to do this?
<?php $category = get_the_category();
$parent = get_cat_id($category[0]->category_parent);
$parent = $category[0]->cat_id; ?>
<ul class="recent-widget-container">
<?php
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'showposts'=>5, // Number of related posts that will be shown.
'caller_get_posts'=>1,
'exclude'=>7932,
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<?php $id = get_the_ID(); ?>
<?php $image_meta = get_post_meta($id,'image',true); ?>
<li class="recent-widget-post">
<div class="recent-widget-img">
<?php if ( (isset($image_meta)) && ($image_meta != '') ) {
woo_image('key=image&width=140&height=80');
}else{ echo $small_placeholder;} ?>
</div>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<p><?php get_the_excerpt_limit( 75, '...' ); ?></p>
<div class="fix"></div>
</li>
<?php
}
}
}
$post = $orig_post;
wp_reset_query();
?>