generateblocks icon indicating copy to clipboard operation
generateblocks copied to clipboard

Query Block : toggle to not display all the posts in editor as an option

Open thisbit opened this issue 3 years ago • 2 comments

Description

When one wants to show a larger number of posts per page it becomes cumbersome to load each time editor is opened or reloaded to show all these. On the front one cam cache these etc. But if one is building a complex page with several sections, each with query block it can become difficult for gutenberg to hangle displazing these in editor.

Steps for testing

  1. Make a query set posts per page to 40.
  2. Set another section with 10 posts.
  3. Another with 10
  4. Ssave page and close it.
  5. Open it again ... it takes a while to load.

Solution:

Would be nice to have a toggle "dont show posts in editor" so that they can not be rendered when not needed. Editing of pages would be more elgant like this.


thisbit avatar Jun 09 '22 16:06 thisbit

@thisbit indeed it would be cool to have such option, but we need to think in a good system, cause in some cases like two column layouts you may want to display 2 posts. Maybe a filter that you can overwrite the per page configuration only in the editor. We will defenetly consider this for future version, thank you.

JeanPaiva avatar Jun 10 '22 13:06 JeanPaiva

Maybe have a posts per page for editor toggle that does not affect the front?

thisbit avatar Jun 10 '22 13:06 thisbit

@thisbit we have introduced a post cap for the editor, the default is 50 posts. You can easily change with the following filter:

add_filter( 'generateblocks_query_loop_editor_posts_cap', function() {
    return 10;
} );

JeanPaiva avatar Jan 12 '23 01:01 JeanPaiva