Archived topic
Different text in blue box for each page
46 replies · Started by Karen on August 31, 2022
Hi Karen,
you can use a GenerateBlocks Query Loop see here:
https://www.screencast.com/t/RGk2FcPvLQ
Note the Order By > Random parameter is a GB Pro feature.
Thanks. We have Pro.
But the video starts without saying what/where to create it. Are you creating it in Elements or where?
Also, what's next?
If you can add a step by step for creating the blue box (in Elements like we did?), pulling in the query, etc.
Aah - ok you can built it wherever you need it.
A Block Element - Hook would make sense, then you can hook it into your pages or posts.
Okay, then what's next? How do we display the CPT (title and post) in the blue box? Do we create another element for the blue box like we did already or or global style or...?
No need for other containers.
In the Query Loop there is the Post Template container, select that and give it a background. See here:
OK, will try it. Thank you. This is all new to us. The block editor and GP.
Let us know how you get on :)
Will do! 👍
Any idea why I'm getting "Order" drop down instead of "Order by" drop down?
https://www.dropbox.com/s/uhjvyaf1m0nupkx/query-order.jpg?dl=0
Also, FYI, the title is on the bottom and actual text/content is on top.
Note the Order By > Random parameter is a GB Pro feature.
Order is in free. Order By is only in GenerateBlocks Pro.
If you don't have GB Pro then:
1. Add this PHP Snippet to your site:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'orderby-rand' ) !== false ) {
$query_args['orderby'] = 'rand';
}
return $query_args;
}, 10, 2 );
2. Edit the Query Loop, select its Grid Block and in Advanced > Additional CSS Class(es) add: orderby-rand
And that will set the WP Query orderby=>rand parameter.
Thanks! But we do have GP and GB pro. Happy to add more code but would like the cleaner drop down if possible?
If you have GB Pro then you should see order and order by in the drop down.
Are both plugins, GB Free and GB Pro up to date ?
Weird. Yes. They're both up to date. Should GB say Pro? In Plugins, GP says Pro but GB doesn't say pro but I paid for both.
Scratch that. GB says pro and GP says premium. So yes, I have paid both. Hmmm, what could it be? Do you want login again?
See my screenshot. I'm getting the Order drop down but not the Order by drop down.
Yeah - send us a login and ill take a look :)