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 addition: sibling post/page (omit current post-id) #39192

Open
Tracked by #41405
Humanify-nl opened this issue Mar 3, 2022 · 1 comment
Open
Tracked by #41405

Query loop addition: sibling post/page (omit current post-id) #39192

Humanify-nl opened this issue Mar 3, 2022 · 1 comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Enhancement A suggestion for improvement.

Comments

@Humanify-nl
Copy link

Humanify-nl commented Mar 3, 2022

What problem does this address?

The query loop block is getting better and better, especially with the ability to use patterns for the grids.

One thing I still miss is to be able to omit the current page/post from the query. I want to show page siblings, or related posts under a single-post for example.

Or maybe I am unable to find it?

A use case would be to:

  • Add a query loop block in a template-part (.after-entry or something) and assign it to the single.html template.
  • Make the query loop display 'post' as post type, and omit the current post.

This is heavy used method in blog websites, to show only related posts without the current.

What is your proposed solution?

Related posts
Possibly within the filters part in the inspector controls:

  • A checkbox labeled 'don't show current post in loop'. 'post__not_in' => [ get_the_id() ],

Page siblings
I'm aware this is more complicated (possibly 'custom blocks realm') but maybe in the future.

When 'page' is chosen as post type in the query loop, a filter should show to 'only show siblings'

Not unlike the old query param. 'parent' => get_the_id(),

  • When no parent exists, it should output a message like 'no current parent', and on the front it should be omitted.
  • One could think of an option to select a page parent manually, and only display those children.
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

3 participants