gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Surface 'Posts per page' setting in more templates

Open jameskoster opened this issue 1 year ago • 6 comments

Screenshot 2024-07-17 at 13 25 16

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_page value.
  • When the user supplies a different value a filter is added to modify the template query.

What do you think?

jameskoster avatar Jul 17 '24 12:07 jameskoster

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:

query loop

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.

jasmussen avatar Aug 27 '24 12:08 jasmussen

Yes, good idea :)

jameskoster avatar Aug 28 '24 14:08 jameskoster

Perhaps the segmented control is unnecessary in this case:

posts per page

jameskoster avatar Aug 28 '24 14:08 jameskoster

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?

jasmussen avatar Aug 28 '24 15:08 jasmussen

Yup, works for me.

jameskoster avatar Aug 28 '24 17:08 jameskoster

I shuffled the labels. Do we need to update the issue as well?

jasmussen avatar Aug 29 '24 06:08 jasmussen

Done.

jameskoster avatar Aug 29 '24 13:08 jameskoster

We need to improve that "Default" state of the query block to connect with the posts per page setting.

mtias avatar Aug 31 '24 21:08 mtias

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.

jameskoster avatar Sep 02 '24 14:09 jameskoster

The point is I should be able to read what that default is, which comes from global posts per page.

mtias avatar Sep 02 '24 22:09 mtias