Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken pagination links #70

Closed
2 of 4 tasks
iandunn opened this issue Nov 5, 2021 · 6 comments · Fixed by #203
Closed
2 of 4 tasks

Fix broken pagination links #70

iandunn opened this issue Nov 5, 2021 · 6 comments · Fixed by #203
Assignees
Labels
[Team] Neso Team Neso [Type] Bug Something isn't working

Comments

@iandunn
Copy link
Member

iandunn commented Nov 5, 2021

It looks like all the uses of pagination are broken.

  • front-page/ template parts - "See all ..." links to /?query-page=2 instead of /page/2. That might be a bug with wp:query-pagination-next, or maybe we're using it wrong. See Restore "All Posts" header etc #55
  • archive/category templates - links to pages have broken query-page param instead of page/n format
  • archive/category templates - shown even when cat only has 1 post
  • Look for those problems in other templates too, and fix any instances
@iandunn iandunn added the [Type] Bug Something isn't working label Nov 5, 2021
@iandunn iandunn added this to the Initial Launch: Functionality milestone Nov 5, 2021
@iandunn iandunn changed the title Fix /page/2 link in home.html Fix broken pagination links Nov 10, 2021
@iandunn iandunn changed the title Fix broken pagination links Fix broken/hacky pagination links Nov 10, 2021
@iandunn iandunn changed the title Fix broken/hacky pagination links Fix broken pagination links Nov 10, 2021
@jeffikus
Copy link
Collaborator

jeffikus commented Dec 7, 2021

@scruffian @matiasbenedetto is this related to any of the work we've been doing on pagination? Anything we can use from there to help here?

@scruffian
Copy link
Collaborator

No, this is unrelated

@ryelle
Copy link
Contributor

ryelle commented Dec 14, 2021

It looks like if you use inherit on the main posts query, the pagination link on "See All Posts" should link to /page/2/ WordPress/gutenberg#32531 (comment)

<!-- wp:query {"query":{"perPage":5,"inherit":"true"},"tagName":"section","className":"front__latest-posts","align":"full"} -->

@tellyworth
Copy link
Contributor

It looks like if you use inherit on the main posts query

The problem with this is that when you use inherit the query block seems to ignore other query parameters like perPage. I'm not sure if that's expected behaviour or a bug.

@ryelle
Copy link
Contributor

ryelle commented Dec 17, 2021

That's a good question. It looks like the block query gets merged into the main query, but values in the main query will override the block values… I think that is intended. If you try this through the editor, hitting "Inherit query from template" turns off all the UI controls for taxonomies and per-page settings.

@tellyworth
Copy link
Contributor

Thanks for digging that up @ryelle. I'm pretty sure the code in render_block_core_post_template() has a number of undesirable side effects that are going to cause problems for block themes. As well as the perPage thing noted above, this means you get inconsistent versions of query vars in filters. I think I'll have to write up some detailed test cases to clarify and figure out how to move forward.

tellyworth added a commit that referenced this issue Dec 22, 2021
This lets us use `inherit:true` for the `wp:query` blocks in the page templates. Without which we run into problems with pagination etc.

See #70 for discussion.
tellyworth added a commit that referenced this issue Dec 23, 2021
* Use a filter to set posts_per_page for some categories

This lets us use `inherit:true` for the `wp:query` blocks in the page templates. Without which we run into problems with pagination etc.

See #70 for discussion.

* Add explanatory notes in html comments

Co-authored-by: Ian Dunn <ian@iandunn.name>

* Rename the filter to override_category_query_args

Co-authored-by: Ian Dunn <ian@iandunn.name>
@tellyworth tellyworth self-assigned this Jan 5, 2022
@tellyworth tellyworth added the [Team] Neso Team Neso label Jan 7, 2022
@ryelle ryelle assigned ryelle and unassigned tellyworth Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Team] Neso Team Neso [Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants