Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1323408

    Hi there,

    we would like to display both posts and portfolio on a masonry grid – is that possible somehow?
    Right now, we can only select between portfolio or normal categories.

    Thanks in advance

    #1323600

    Hey emilconsor,

    Thank you for the inquiry.

    Yes, this should be possible by adjusting the tax_query using the avia_masonry_entries_query filter. Example:

    add_filter("avia_masonry_entries_query", function ($query) {
    	$query["tax_query"] = array(
    		'relation' => 'OR',
    		array(
    			'taxonomy' => 'portfolio_entries',
    			'field' => 'id',
    			'terms' =>
    			array(
    				0 => 8,
    				1 => 9,
    				2 => 10,
    			),
    			'operator' => 'IN',
    		),
    		array(
    			'taxonomy' => 'category',
    			'field' => 'id',
    			'terms' =>
    			array(
    				0 => 2,
    				1 => 3,
    				2 => 1,
    			),
    			'operator' => 'IN',
    		),
    	);
    	return $query;
    }, 10, 1);
    

    Make sure to adjust the array of IDs and use the actual ID of the terms inside certain taxonomies (portfolio_entries, category).

    array(
    				0 => 8,
    				1 => 9,
    				2 => 10,
    			),
    

    Best regards,
    Ismael

    #1323726

    Hi Ismael,

    thank you! That worked.

    #1323747

    Hi,

    Awesome! Glad to know that it is working. You may need to add conditional functions if you need this to be applied on a specific page or a specific masonry element. Please feel free to open another thread if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Display posts and portfolio in masonry grid’ is closed to new replies.