foreach loop excluding a catagory
-
I am trying to exclude a filter from a post. The theme I am using has the following code
// Get the filter > Category of item $catz = wp_get_object_terms($post->ID,'filters'); foreach($catz as $cat) { $currcat = $cat->slug; $catname = $cat->name; break; }
I have tried putting putting an if ($cat = -20); to exclude my filter id, but it didn’t work. Also I tried (‘exclude=20&title_li=’) after filters, but that didn’t work either. This is the custom query
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => $counter_folio, 'paged' => $paged, 'order' => 'DESC' );
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
I thought I should put the exclude in this section of the code but it didn’t work either.
This is a template-portfolio file.
thank you for your help.
- The topic ‘foreach loop excluding a catagory’ is closed to new replies.