[Support request] Reusable block with Query Loop: show children pages of current page

Home Forums Support [Support request] Reusable block with Query Loop: show children pages of current page

Home Forums Support Reusable block with Query Loop: show children pages of current page

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #2371815


    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 help

    Customer Support

    Hi John,

    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.


    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?

    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.


    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!

    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.


    Gotcha, thank you. I haven’t heard of the portable hook, I will need to look into that

    Customer Support

    You’re welcome John!


    Hey Fernando,

    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.

    Customer Support

    Hi Justin,

    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.


    Will do, thank you!

    Customer Support

    You’re welcome and thank you as well!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.