WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.47k stars 4.18k forks source link

Query Loop: Allow setting to show ALL posts #51219

Open kwisatz opened 1 year ago

kwisatz commented 1 year ago

Description

Although the setting advertise this, setting a value of 0 is not allowed.

In this case, the editor does not freeze as in #33270.

Step-by-step reproduction instructions

  1. Add a query loop
  2. Click the settings button (not sidebar!)
  3. Try to set 0 for "items per page"
  4. observe how 0 is not accepted

Screenshots, screen recording, code snippet

Edit-Page-“Front-Page”-‹-LuxProvide-—-WordPress.webm

Environment info

WordPress 6.2.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

ndiego commented 1 year ago

@kwisatz I was able to confirm this, but I believe this is the correct implementation. Is there a scenario when you wouldn't want to show any posts?

To show all pages use 0 (zero).

Perhaps you are referring to this helper text? It confused me for a second, but it refers to the "Max Pages to Show" option. Setting 0 shows all pages in the pagination.

kwisatz commented 1 year ago

I am indeed referring to that helper text and yes I now see that I misread it for posts, instead of pages. My desired behavior is simply to display all posts, in the same way that posts_per_page => -1 handles this in programmatical WP_Query usage.

github-actions[bot] commented 1 year ago

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

jordesign commented 1 year ago

My desired behavior is simply to display all posts, in the same way that posts_per_page => -1 handles this in programmatical WP_Query usage.

That being the case - May I recommend changing the title of the issue to reflect the desire to show all posts within a Query Loop block?

I do know that can have performance issues - so may well be something that can't be offered.

kwisatz commented 1 year ago

I do know that can have performance issues - so may well be something that can't be offered.

Of course.

The question would be: Would you rather try and educate users that their choice may be problematic, or disallow them to realize the layout they would like to see?

TullariS commented 11 months ago

Hi all,

When editing the block's display settings it does say "To show all pages use 0 (zero).". Currently I need to set it to 100 as a cheat and I should be able to simply put "0".

As for performance issues, all results doesn't necessary mean "show literally all posts on the database". Query loops variations can be created where non-paged results can make perfect sense, so WP can't really educate or disallow as it is not aware of how the block is being used.

ffsoft83 commented 9 months ago

Hi, just wanted to chip in my thoughts here. I run a website where I need to show beyond 100 posts and I do not want to use pagination. Performance impact has been minimal at best. I don't think anyone should be hard stopped from going above 100 should they choose to.

aadilayub commented 2 months ago

I also was looking for this setting today. There should be a way to show all posts without having to make up an arbitrarily large number to set the max posts setting to.