-
Hello,
As an old WP Show Posts user I am not really happy to see that some features have disappeared and makes migrating from WP Show Posts to generateblocks Query Loop quite a nightmare.
Anyway:
I was using WP Show Posts Pro to create custom PAGE lists based on a page meta_key / meta_value filter.
How can I do this with generateblocks Query Loop?
Thanks,
-
Hi there,
Do you mean only show posts that have a certain meta_value in the query loop?
If so, try this method:
1. add an additional CSS class for the Grid block of the query loop block, eg.
my-query2. add below PHP code:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-query' ) !== false ) { $meta_query = array( array( 'key' => 'my_meta_key', //change it to your meta key 'value' => 'my_meta_value', // change it to your meta value ), ); $query_args = array_merge( $query_args, array( 'meta_query' => $meta_query, ) ); } return $query_args; }, 10, 2 ); -
Hello Ying,
Unfortunately that’s a major drawback compared to WP Show Posts:
I have like 10 “lists” that would need different CSS classes and code snippets. Pretty close to un-usable when in WP Show Post it was just a matter of configuring the meta_key and meta_value like this:
WP Show Posts Loop Filter on meta_key and meta_value
I can’t seem to be able to quote Tom @tom but this should have been migrated into the Query Loop in a user friendly manner.
Cheers,
- You must be logged in to reply to this topic.