- This topic has 11 replies, 3 voices, and was last updated 3 months, 4 weeks ago by Fernando.
October 12, 2022 at 10:34 pm #2371815John
I spent quite a bit of time designing a Query Loop template in one of my pages, with the intent of reusing it on other pages. It shows sub-pages in a “card” format with specific information in each (using subpages custom fields etc.).
In order to show subpages (i.e. children pages), I selected the Query Parameter called “Parents”, and selected as parent the page I was currently editing (since I wanted to show its children pages).
Once done, I saved this query loop as a reusable block, and moved to the next page to use it. However, I now realize that I can’t change the parameter of the Parent page. What I really want instead of selecting a Parent page, is to tell the query “select as Parent whichever page the Query Loop is inserted in.” Is there any way to do that?
Unfortunately without that option, my reusable block is not very useful since I can’t reuse it 😉
Thank you for your precious helpOctober 12, 2022 at 10:40 pm #2371818Fernando Customer Support
It’s possible with GenerateBlocks Pro. Example: https://share.getcloudapp.com/geuyP2pm
Relevant article: https://generateblocks.com/creating-related-posts-with-query-loop-block/
It would also be better if you add it through a Block Element.October 12, 2022 at 10:48 pm #2371822John
Fernando, thank you that’s indeed exactly what I’m looking for. The good news is that it’s possible.
As to the Block Element, why would it be better than a Reusable Block? I actually asked myself that question, and decided to go with Reusable Blocks because it’s easier to implement, I see them in the post editor, and it’s more flexible as to placement on the page. It sounds like I’m missing a benefit of the Block Element?October 12, 2022 at 10:59 pm #2371827Fernando Customer Support
Are you planning to place the Query Loop in specific places within the content? If so, the is also doable with a Block Element. You just need a portable hook. Example: https://generatepress.com/forums/topic/hooks-related-question/#post-2170598
I find a Block Element easier to maintain. Otherwise, utilizing the WordPress Reusable Block should be good as well.October 12, 2022 at 11:09 pm #2371837John
All in all, I could probably use either. But I was wondering if there was any specific advantage to one or the other, feature-wise or performance-wise. Thank you Fernando!October 12, 2022 at 11:34 pm #2371879Fernando Customer Support
1. For one, Elements can be used for making changes to the ‘theme’ layout or for inserting content into a theme template – areas of your site that cannot be reached from the Post Editor – thus, the Reusable Block.
2. Choosing on which pages an Element appears on can be easily controlled through the Display rules whereas with a Reusable Block, you need to manually add it to each page – which can also be done with a Block Element through a portable hook as mentioned.October 13, 2022 at 7:05 am #2372294John
Gotcha, thank you. I haven’t heard of the portable hook, I will need to look into thatOctober 13, 2022 at 5:10 pm #2372848Fernando Customer Support
You’re welcome John!November 21, 2022 at 4:20 pm #2426362Justin
I have a similar issue that I’m wondering if you can help me with. In summary, I’m trying to use a reuseable block within a GPblocks query loop.
To start, I created a GPBlocks query loop and then set its taxonomy to a posts category. I then made the grid within that query loop a reusable container. My goal is to create a blank GP query loop on future pages that has a different posts catagory, but then add the reuseable block grid to control styles globally across my site (if needed in the future). In other words, the query loop controls what posts appear in the grid, and the “child” reuseable block controls the styles that appear in the grid.
It actually works in the WP editor, but not in my staging site. Subsequent pages where I add the reuseable block show posts from the first page where I created the reuseable component.
Here’s the page where I made the reuseable block (staging user/pw: dev/dev)
Here’s a page where I tested adding it to a new, blank query loop. (staging user/pw: dev/dev). There should only be one article that appears in this query loop (and it behaves properly in the editor), but it shows post assigned to a different category when I publish and check on my staging site.
Thanks in advance for any insight you can provide.November 21, 2022 at 5:35 pm #2426391Fernando Customer Support
So we can take a closer look at your structure, can you open a new topic and share admin login credentials there?
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
You can’t use the Private Information field if you’re not the thread starter – thus, the need to open a new topic. Please share the description of the issue there as well.November 21, 2022 at 6:50 pm #2426451Justin
Will do, thank you!November 21, 2022 at 6:52 pm #2426453Fernando Customer Support
You’re welcome and thank you as well!
- You must be logged in to reply to this topic.