Display All Child Pages-Looper Provider

Hi there,

Loving the new update, thanks for all your hard work on creating such a comprehensive theme.

I am working on a portfolio page at the moment and have decided to use your new looper feature to pull in content. I am using pages for project write ups, and want to display all the child pages on the projects page.

I’ve gotten as far as setting up a row as a looper provider, and setting the columns within as consumers. Working perfectly on the first three columns.
My question is, how do I go about showing the rest of the child pages in a new row without repeating pages that are already displayed?

I currently have two other child pages which aren’t displaying. I would have thought I could specify how many pages I want displayed, like you can with the post looper provider.

Many thanks in advance, let me know if you need any more info.

Hi Florin,

Thanks for reaching out.
What you are trying to is not possible with the Current Page Children option of Looper provider, but you can use the Custom option and call a custom function which will return the Child pages of the current page and you will have the option to specify the Offset, so it will show all the post after skipping the number of posts specified.
I have added the following code into my child page functions.php and mentioned the offset in the Looper Provider, and it works fine for me. I would request you to add the following code into your child theme’s functions.php and call the function as mentioned in the screenshot.

add_filter('cs_looper_custom_childpage', function($result, $args) 
{
    $page_args = array(
        'post_type'      => 'page',
        'posts_per_page' => -1,
        'post_parent'    => get_the_ID(),
    );
    $cp =new WP_Query($page_args);
    $child_pages=$cp->posts;
    return $child_pages;
}, 10, 2);

test-new-Content-Pro (35)

Please remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something in your site nor will we enhance it.

Thanks

1 Like

Thanks for the help, this works perfectly. Would be nice to have the same kind of functionality built into the child pages looper option maybe.

Much appreciated

You are most welcome.

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