I want this conditional to work on all single posts EXCEPT if it is in category 8... but it doesn't seem to work?
if ( is_single()||!in_category('8')) {
This is my full code
<?php
if ( is_single()||!in_category('8')) {
$categories = get_the_category();
if ($categories) {
foreach ($categories as $category) {
// echo "<pre>"; print_r($category); echo "</pre>";
$cat = $category->cat_ID;
$args=array(
'cat' => $cat,
'post__not_in' => array($post->ID),
'posts_per_page'=>99,
'caller_get_posts'=>1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '<h2>The '. $category->category_description . ' label</h2>';
echo '<p>These are more clothes from the same '. $category->category_description . ' label</p>';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php get_the_image( array( 'default_size' => 'medium', 'width'=>'130', 'height'=>'130', 'image_scan' => true, 'link_to_post' => true, 'link_to_image' => false, 'image_class' => 'alignleft', 'default_image' => 'http://spinifexcoolwear.com.au/wp-content/uploads/coolwear-260x277.jpg') ); ?>
<?php
endwhile;
} //if ($my_query)
} //foreach ($categories
} //if ($categories)
wp_reset_query(); // Restore global post data stomped by the_post().
} //if (is_single())
?>