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

Page List: Add parent parameter to show all child pages of current page #31063

Closed
mkaz opened this issue Apr 21, 2021 · 4 comments
Closed

Page List: Add parent parameter to show all child pages of current page #31063

mkaz opened this issue Apr 21, 2021 · 4 comments
Assignees
Labels
[Block] Page List Affects the Page List Block

Comments

@mkaz
Copy link
Member

mkaz commented Apr 21, 2021

What problem does this address?

The goal is to allow a page to create a menu/list of posts of all the children page, sorted by menu_order.

The solution in PHP could something like this:

$args = array(
    'post_type'      => 'page',
    'posts_per_page' => -1,
    'post_parent'    => $parent_id,
    'orderby'        => 'menu_order',
    'order'          => 'ASC',
 );

$child_pages = new WP_Query( $args );

An issue with pages is there is no means to add additional tag or category information as another means of limiting what is returned by the query.

Possible this should just be added to: #24934

@mkaz mkaz added the [Block] Query Loop Affects the Query Loop Block label Apr 21, 2021
@mkaz mkaz added [Block] Page List Affects the Page List Block and removed [Block] Query Loop Affects the Query Loop Block labels May 4, 2021
@mkaz
Copy link
Member Author

mkaz commented May 4, 2021

For my case of trying to show a listing of all child pages, this might be a better for the Page List

@mkaz mkaz changed the title Query Block: Add parent parameter to query on Page List: Add parent parameter to show all child pages of current page May 4, 2021
mkaz added a commit that referenced this issue May 4, 2021
- Add a childrenOnly attribute to Edit
- Update render to use attribute and only pull in children

Fixes #31063

?? This uses global $post which is probably not ideal
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 4, 2021
mkaz added a commit that referenced this issue Jun 18, 2021
- Add a childrenOnly attribute to Edit
- Update render to use attribute and only pull in children

Fixes #31063

?? This uses global $post which is probably not ideal
@talldan
Copy link
Contributor

talldan commented Aug 5, 2021

I've closed #33883 as a duplicate. That suggests being able to specify the parent page for filtering the results as well as the option to use the current page. The two requests are so similar that I think it would make sense to combine them in this issue.

mkaz added a commit that referenced this issue Sep 22, 2021
- Add a childrenOnly attribute to Edit
- Update render to use attribute and only pull in children

Fixes #31063

?? This uses global $post which is probably not ideal
mkaz added a commit that referenced this issue Sep 28, 2021
- Adds a showOnlyChildPages attribute to Edit
- Update render to use attribute and only pull in children
- Do not show on post pages which will not have a parent
- Allow showing on wp_template pages

Fixes #31063
mkaz added a commit that referenced this issue Oct 8, 2021
- Adds a showOnlyChildPages attribute to Edit
- Update render to use attribute and only pull in children
- Do not show on post pages which will not have a parent
- Allow showing on wp_template pages

Fixes #31063
mkaz added a commit that referenced this issue Oct 30, 2021
- Adds a showOnlyChildPages attribute to Edit
- Update render to use attribute and only pull in children
- Do not show on post pages which will not have a parent
- Allow showing on wp_template pages

Fixes #31063
@AddoSolutions
Copy link

+1 for this – would be very helpful and solve several other issues. Are there any workaround for this as of yet?

@scruffian
Copy link
Contributor

Closed by #45861!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Page List Affects the Page List Block
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants