I'm trying to exclude a category from an embedded custom post type loop, but am a bit stuck.
Ideally I'd like to not use the category ID as the theme maybe used across different sites and databases and I can't guarantee the category I wish to exclude will always have an Id of x.
My original loop code looks like this:
<?php $temp_query = $wp_query; query_posts('post_type=projects&showposts=4&order=ASC');?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); // grid loop. ?>
The category I was the exclude is named 'showreel'. I've found the following code elsewhere which I think might provide a solution but I'm not sure how to combine it with my existing loop:
$exclude = get_cat_ID('News'); $q = 'cat=-'.$exclude; query_posts($q);
Is this something that can be done? If so, any pointers of how would be greatly appreciated.