-
bennyuk2
I’m sure this is a simple one but I cant find the answer.
Can I use a query loop to show results from POSTS and PAGES. Both share common taxonomy ( categories)
Thanks
Ben -
Hi there,
yes, but for now you have to use some PHP.
1. Add this PHP Snippet:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'posttype-query' ) !== false ) { $query_args[ 'post_type' ] = array('post', 'page'); } return $query_args; }, 10, 2 );
2. In the Query Loop, select the Grid Block and give it a CSS class of:
posttype-query
-
bennyuk2
Thats awesome. works perfectly, many thanks.
Ben -
You’re welcome
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.