Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #375867

    I’m using magazine to draw through posts and I want exclude portfolio items with a certain category. How can I do that?

    #376342

    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

    #376757

    Thanks Elliott but this works for ‘includes’ I would like to exclude which is important when items have multiple categories ticked.

    #376761

    Hi!

    CTRL + click ( CMD + click on Mac ) would exclude if you click on selected ones.

    Regards,
    Yigit

    #376766

    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?

    #377007

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.