Archive Template - Current Page Child and Sub-child

Hi

I’d like to create an Archive Page with a List of child and sub-child.

Is there a solution?
Nested child?

Thank You

Hello Daniele,

Thanks for writing in! Please be informed that pages do not have any archives. Yes, you can display a list of child pages on the sidebar of the page. You can either use a widget from Appearance > Widgets and use the Widget Area element to be able to insert it into your page.

Best Regards.

Hallo @ruenel

Sorry for the confusion.
It is NOT an Archive Template

I have a Page with a Looper inside which returns a list of child pages (of the current page)

image

Some of these child pages have other child pages (Grandchild)

Is there any way in order to receive a list of Child and Grandchild of the current page?
Nested child is it possible?
What would be the query string in order to tell the listed child element to return the child pages of itself?

Thank You

Hello Daniele,

With the Looper Provider Current Page Children, it will only return the child pages of the current page. It will not return the grandchild of the current page. You may need to use Looper Provider Custom along with a custom PHP code that returns the child and its sub-child pages. This would be a complicated request because custom PHP coding is beyond the scope of our support. I would recommend that you use the Page List widget, and use the Widget Area element to display to the current page that you are working on.

1.) Go to Appearance > Sidebars and create a custom sidebar.
2.) Go to Appearance > Widgets and assign the Page List widget to the newly created custom sidebar.
3.) Edit your page, insert a Widget Area element, and select the newly created sidebar.

Best Regards.

Hello @ruenel

Thank You for your support

The suggested Sidebar/Widget solution is not what I was hoping to get because:

  • it does not allow any formatting and
  • it returns the list of ALL the pages of the Site

I would like to be able to:

  • format the list of results and
  • obtain the list of child (and sub-child) pages with respect to the page where I am on.

I can get a list of all child pages with the Current Page Children Looper Provider Type,
but I would like to create, inside every Looper Consumer ITEM, a NESTED Looper Provider (maybe with Query String Looper Provider Type) in order to obtain Page Children of the current Looper Consumer ITEM.
Something like:
wp query to get child pages where current Looper Consumer ITEM is the parent

Please, could you help me in order to understand if it is possible or NOT?

Thank You

Hello Daniele,

You can have a WordPress query like this:

// Query child pages
$query = array(
    'post_type' => 'page',
    'post_parent' => $current_page_id,
    'order' => 'ASC', // You can change the order if needed
    'orderby' => 'menu_order', // You can change the sorting order if needed
    'posts_per_page' => -1, // -1 to display all child pages
);

Run var_dump( http_build_query( $query ) ); in your child theme’s functions.php once to get the resulting query string. You can then use the query string to your nested Looper.

Please check out these threads to know how to get the query string:

Hope this makes sense.

Thanks to your suggestion I managed to obtain the desired result.

Thank you for your precious assistance

Hi Daniele,

Glad to know that you are able to obtain the desired result.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.