Site logo

Archived topic

Reusable Blocks with different queries?

7 replies · Started by Alejandro on January 3, 2023

Viewing posts 1–8 of 8

Hi,
I suppose that this has been asked a thousand times, but I still have a doubt.
I do have over a hundred pages in which the structure is the same except the query (based out in tags).

Is there a way to use reusable blocks / global styles / or whatever, to re-use the same structure changing the query?

https://imgur.com/a/HrdHIMr

Thanks!

Hi there,

sorry i don't quite understand what you mean.
Do you have an example that illustrates what you need ?

Hi David,
Ie, I have these 3 pages:
https://proyectoviajero.com/continentes/america-del-norte/estados-unidos/
https://proyectoviajero.com/continentes/america-del-norte/canada/
https://proyectoviajero.com/continentes/america-del-norte/mexico/

Now, I want to change a little bit the design and I have to go one by one in changing some blocks.
The structure of the 3 is the same except for the query: the posts are pulled out based in tags (being these: USA, Canadá and México).

Is there a way to set up a reusable block or global style or whatever to replicate the same design? (with different queries for the different pages).
I want to avoid in the future to change pages one by one.

Thanks!

If you select all the blocks within the Post Template block, and Convert it to a Reusable Block.
You can then use that in any Query Loop block and in the future just edit any one to update them all.

But if I do this, the system will respect the different queries in the future?
I guess that I am missing something....

I mean: the reusable block is EXACTLY the same all over the site right? If I change one setting (a maring, a query o whatever) it will be populated in all the posts/pages where the reusable block is placed right?

Reusbable blocks are kinda a template part, if you change one instance of them on any page then all will update.
For your needs - see here:

https://www.screencast.com/t/P7nqZceybD

Make a reusable block to go inside the Post Template block.
Then the Query Loop itself is not linked to the reusable block, and you can have different query loops on different pages but they all display the dynamic content from the reusable block.

Got it.
Thanks David!

By the way: do you have search queries capabilities to search by post context / information?

Do you have an example of that ?

This archived topic is closed to new replies.