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

Query Loop: Allow setting to show ALL posts #51219

Open
kwisatz opened this issue Jun 4, 2023 · 8 comments
Open

Query Loop: Allow setting to show ALL posts #51219

kwisatz opened this issue Jun 4, 2023 · 8 comments
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Enhancement A suggestion for improvement.

Comments

@kwisatz
Copy link

kwisatz commented Jun 4, 2023

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
Copy link
Member

ndiego commented Jun 6, 2023

@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.

@ndiego ndiego added the [Status] Needs More Info Follow-up required in order to be actionable. label Jun 6, 2023
@kwisatz
Copy link
Author

kwisatz commented Jun 6, 2023

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
Copy link

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.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jun 22, 2023
@jordesign
Copy link
Contributor

jordesign commented Jul 10, 2023

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.

@jordesign jordesign added [Type] Enhancement A suggestion for improvement. [Block] Query Loop Affects the Query Loop Block and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Jul 10, 2023
@kwisatz kwisatz changed the title Query Loop Block does not allow setting 0 for items per page Query Loop Block does not allow setting -1 to show all items Jul 10, 2023
@kwisatz
Copy link
Author

kwisatz commented Jul 10, 2023

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?

@jordesign jordesign changed the title Query Loop Block does not allow setting -1 to show all items Query Loop: Allow setting to show ALL posts Oct 26, 2023
@jordesign jordesign removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Oct 26, 2023
@TullariS
Copy link

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants