• Resolved ecabral

    (@ecabral)


    Hi there!

    I’m redesigning my website, originally created with a classic theme and a popular website builder, using only the block editor and twenty twenty-four theme. The learning curve has been steep, so I’m likely missing something here…

    I’m using the query loop to display posts. I’ve played around with pretty much all patterns and am confused with the following: grid and offset patterns (ie, patterns displaying the posts in multiple columns) only seem to support pagination per post template, rather than per pattern. Take a look at these setups:

    Because there are two query loops per column here, there are also two post templates and hence two pagination blocks (!). My desired behavior would be one pagination block per pattern.

    I also noticed that the pagination URLs of grid patterns in general result in ugly URLs such as: /?query-321-page=2 , /?query-321-page=3, /?query-322-page=2, etc. One column patterns result in familiar pagination URLs such as /page/2/, /page/3/, etc.

    I read the documentation, namely:

    Pagination block is included by default if you choose a correct pattern in a Query Loop block. That said, you can also insert it manually when needed.

    What is a “correct pattern”? How can I manually insert the pagination block for grid and offset patterns?

    What about the pagination URLs – is there a workaround here?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator janmtm

    (@janmtm)

    Hi @ecabral

    I understand how the term ‘correct’ might be confusing in this context. You can suggest clearer wording by using the feedback form at the bottom of the page: “Was this article helpful? How could it be improved?”

    ‘Offset’ modifies the query to skip a specified number of posts, which is why pagination isn’t displayed by default when using it.

    Here’s an example of post patterns that do include pagination by default:

    Screenshot 2024 12 18 at 11 33 58 AM

    I’m not sure where you’re seeing the page URL links that you asked about, but to adjust how your links display (e.g., to include or exclude details like the post name or category), navigate to Settings > Permalinks in your WordPress dashboard and choose or customize your structure.

    I hope this helps! If you have further questions, feel free to ask.

    Thread Starter ecabral

    (@ecabral)

    Hi @janmtm ,

    thanks for getting back to me!

    RE: ‘Offset’ modifies the query to skip a specified number of posts, which is why pagination isn’t displayed by default when using it.

    I see, so any pattern that include grids or multiple columns does not support pagination (as in my two examples), correct? “Offset” is the actual name of one such pattern…

    Is this by design or can I expect to see this being “fixed” at some point?…

    RE: I’m not sure where you’re seeing the page URL links that you asked about

    This is visible when you add pagination blocks to query loops using a grid layout. It’s not Permalinks-related.

    Moderator janmtm

    (@janmtm)

    Hey @ecabral

    Well, it’s not that it isn’t supported in the others. It only means that it isn’t included in the ‘default pattern’. You are able to add it manually.

    Here’s an example of how it looks when the Pagination block is added manually:

    Screenshot 2024 12 18 at 11 26 18 AM

    This is visible when you add pagination blocks to query loops using a grid layout. It’s not Permalinks-related.

    For the links you mentioned, could you share a screenshot or explain further? I’d like to better understand what you mean so I can assist more effectively.

    Thread Starter ecabral

    (@ecabral)

    Hi @janmtm ,

    Yes, I’m able to add the pagination block manually and that’s exactly my point! E.g., with the “Offset” (native name) layout (this block structure I shared previously), I can only add the pagination block per post template. Given that there are two post templates (one for each column), this is the result on the frontend. As expected I get one pagination block per column, but what I would like is one pagination block per (query loop) pattern. That’s what I get when I use list-type patterns such as this.

    As to the URLs, for the “Offset” pattern the “ugly URLs” I alluded to previously are visible here and here (bottom corner on the left). Not that I would want to have the two pagination blocks side by side, but well…, that’s what I meant.

    Moderator janmtm

    (@janmtm)

    Hi @ecabral

    Thank you for patiently explaining further. I can understand your frustration certainly.

    You are aiming to achieve a single pagination across multiple columns. This is indeed achieved with an ‘offset’ in the second Query Loop, as ‘offset’ essentially enables the Query Loop block to skip a certain number of posts before starting output. The Pagination Block however, is intentionally tied to its respective Query Loop. This design prevents conflicts when multiple pagination instances exist on the same page.

    There are some other options you can explore, like a plugin offering enhanced pagination options or you can consider creating a PHP-based query of your own within a custom template. The latter requires coding skills, but it will provide you with the most flexibility.

    There is also the WordPress Pattern Directory that you can browse to see if a pattern there is closer to your preference, or one that you can start with and tweak further as you need.

    Regarding your second question, there is currently no direct way to change the pagination URL structure (/?query-321-page=2) in grid layouts created with Query Loop blocks. This is because each Query Loop instance gets its own unique identifier to handle pagination independently. The clean /page/2/ URLs are typically associated with main query pagination rather than custom Query Loop blocks.

    I hope this might point you in a helpful direction for your next steps!

    Thread Starter ecabral

    (@ecabral)

    Thanks for your help, @janmtm ! Hopefully this thread will be useful to other people who, like me, were also expecting to get one pagination block per (query loop) pattern (grid, column or list).

    Moderator janmtm

    (@janmtm)

    You’re most welcome! @ecabral

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Query loop pagination’ is closed to new replies.