I’m using magazine to draw through posts and I want exclude portfolio items with a certain category. How can I do that?
Hi Tallnick!
When you edit the magazine shortcode you can select it to display portfolio entries. When you do that you can then select whichever portfolio categories you wish to display.
If your on Windows then hold CTRL + click on the categories to select exactly which categories you wish to display.
Best regards,
Elliott
Thanks Elliott but this works for ‘includes’ I would like to exclude which is important when items have multiple categories ticked.
Hi!
CTRL + click ( CMD + click on Mac ) would exclude if you click on selected ones.
Regards,
Yigit
Sorry, not making myself clear.
The portfolio items have AND and OR properties. eg the Category ‘Driving’ can have the cat’ driving AND temporary OR permanent
When I filter the portfolio I want to show driving AND temporary NOT driving AND permanent. Deselecting permanent won’t work as it will pull the posts through that contain driving.
Does that make sense?
Hi!
Add this to the bottom of your functions.php file.
add_filter( 'pre_get_posts', 'enfold_customization_query' );
function enfold_customization_query( $q ) {
if ( is_page( 321 ) ) {
$tax = array(
array(
'taxonomy' => 'portfolio_entries',
'field' => 'id',
'terms' => array( 10 ),
'operator'=> 'NOT IN'
)
);
$q->set( 'tax_query', $tax );
return $q;
}
}
And change “321” to the ID of your page and “10” to the ID of the category you wish to exclude.
Best regards,
Elliott