Surface 'Posts per page' setting in more templates
The Blog Home template has a setting that enables users to change the number of posts displayed per page. Behind the scenes this modifies the global posts_per_page option.
To enable greater design expression it would be good to consider bringing this affordance to other archival templates:
- author.html & family (author-$id, etc.)
- category.html & family
- tag.html & family
- taxonomy.html & family
- date.html
- search.html
In terms of how it works, my expectation would be something like:
- By default, each template would inherit the global
posts_per_pagevalue. - When the user supplies a different value a filter is added to modify the template query.
What do you think?
When the user supplies a different value a filter is added to modify the template query.
We recently changed the behavior of the Query Loop block to have a segmented control defaulting to "Default", with an option to set a "Custom" query:
Can we do something similar here? I.e. instead of saying Posts per page 6, it might say Posts per page Default (6), and then the flyout could hold a similar toggle between Default and Custom? It could even link to where you can change the global setting. The main motivation would be to subtly encourage you not to override this value locally, unless you know what you're doing.
Yes, good idea :)
Perhaps the segmented control is unnecessary in this case:
Looks good, but perhaps instead of "Default" in gray, as the input placeholder, maybe worth showing 10 in the same gray we use for inherited line-height?
Yup, works for me.
I shuffled the labels. Do we need to update the issue as well?
Done.
We need to improve that "Default" state of the query block to connect with the posts per page setting.
That can be a bit tricky based on which template you're editing. If you're editing tag.html and change the posts per page I don't know that you'd expect it to apply globally. Maybe there's an option to apply globally / locally. Needs a bit of design: https://github.com/WordPress/gutenberg/issues/64977.
The point is I should be able to read what that default is, which comes from global posts per page.