[Support request] Code to list child pages of a parent page

Home Forums Support [Support request] Code to list child pages of a parent page

Home Forums Support Code to list child pages of a parent page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1172257
    Matthew

    Hi,

    Copied the template for pages (page.php and content-page.php) into my child theme.

    Renamed them to page-faq.php and faqcontent-page.php.

    Tried to place this code into both above at various locations:

    <?php wpb_list_child_pages(); ?>

    But get whitescreen.

    I am trying to do this:

    https://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-child-pages-for-a-parent-page-in-wordpress/

    Can this code work?

    thanks,

    #1172481
    David
    Staff
    Customer Support

    Hi there,

    can’t see an issue with the code – maybe worth testing the shortcode they provide on a standard Page with children. If that works then the code is good and the problem is with the child templates you have defined.

    May i ask whats the need for the faq template ? Does it differ from a standard page

    #1173181
    Matthew

    good question about the template,
    I was going to ask, can I simply copy the template for pages (page.php and content-page.php) into my child theme. So not rename them to page-faq.php and faqcontent-page.php.

    Then I can put the code in them and it will override the template in the parent theme?

    thanks,

    #1173659
    David
    Staff
    Customer Support

    Thats correct but maybe using a Hook element to display the Child Page list where you need it would be simpler:

    https://docs.generatepress.com/article/hooks-element-overview/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.