Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #670888

    Could you please provide a way to allow pages to be displayed in masonry the way post types are? Perhaps a filter in a child theme where would could add the page id’s or something similar?

    Thanks!

    #672210

    Hey xyzb,

    Thank you for using Enfold.

    This is possible but you will have to filter the default query. Add a masonry element in a page then use this in the functions.php file:

    add_filter( 'avia_masonry_entries_query', 'avia_masonry_query_func', 10, 2);
    function avia_masonry_query_func( $query, $params ) {
    	$args = array(
    		'post_type' => 'page',
    	);
    	$pages = get_pages($args);
    
    	$pageids = array();
    
    	foreach($pages as $page)
    	{
    		$pageids[] = $page->ID;
    	}
    
    	if( is_page('PAGE NAME OR ID HERE') )
    	{
    		$query['post__in'] = $pageids;
    		$query['tax_query'] = '';
    	}
    
        return $query;
    }

    Don’t forget to set the page name or id.

    Best regards,
    Ismael

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