WordPress.org

Ready to get started?Download WordPress

Forums

Exclude category on query_post custom taxonomy (3 posts)

  1. rize
    Member
    Posted 2 years ago #

    I need to exclude a category from showing up posts.
    I registered the taxonomy: portfolio-category
    and added a category: accessories (cat ID 19) under portfolio-category

    How do I exclude posts from accessories category from showing up?
    I tried: 'category' => -19, but it didn't work
    here's my code:

    <?php	$args=array(
    						'post_type' 		=> 'items',
    						'post_status'		=> 'publish',
    						'showposts'			=> intval( get_anolox_option_by('an_homep_count', 3) ),
    						'caller_get_posts'	=> 1,
    
    						'paged'				=> $paged,
    					);
    					query_posts($args);
    
    					$end = array(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45);
    
    					$i = 0;
    					while (have_posts()): the_post();
    					global $post;
    					$i++;
    				?>
    
    				<div class="portfolio-item<?php if (in_array($i, $end)) { echo " right"; } else { echo " left"; } ?>">
    					<div class="portfolio-item-thumb">
    						<a rel="prettyPhoto[mix]" href="<?php echo get_post_meta($post->ID, '_portfolio_data', true); ?>" title="<?php the_title(); ?>">
    							<img src="<?php echo alert_no_thumbnail($post->ID, 'portfolioview'); ?>" alt="" />
    						</a>
    					</div>
    					<div class="portfolio-item-desc">
    						<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    						<?php
    							if( !alert_no_thumbnail($post->ID, 'portfolioview', true) ){
    								print __('Please set the <em>featured images</em> for your portfolio posts, <a href="http://en.support.wordpress.com/featured-images/" target="_blank">learn more</a>', 'an');
    							} else {
    								if( get_option('an_desc_portfolio_off') != "1" ){
    									if(get_post_meta($post->ID, '_port_desc', true) != "" ){
    										echo wpautop(get_post_meta($post->ID, '_port_desc', true));
    									} else {
    										echo wpautop( limit_text( strip_tags(get_the_content()), 90 ) );
    									}
    								}
    							}
    						?>
    					</div>
    				</div>
    
    				<?php endwhile; ?>
    				<?php wp_reset_query(); ?>
  2. Lisa Sabin-Wilson
    Member
    Posted 2 years ago #

    Rize -

    You have the right idea, but give this a try:

    'cat' => -19;

    See if that does it for you.

  3. rize
    Member
    Posted 2 years ago #

    that didn't work too

Topic Closed

This topic has been closed to new replies.

About this Topic