Page Attributes and a Child page

I try to set within a theme Page Attributes and also a Child page. How to enable Page Attributes and also a Child page without a plugin?

As I understand we put inside a functions.php:

function wpb_list_child_pages() { 
 global $post;  
if ( is_page() && $post->post_parent )
    $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );
else
    $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' ); 
if ( $childpages ) {
    $string = '<ul class="wpb_page_list">' . $childpages . '</ul>';
} 
return $string; 
}
add_shortcode('wpb_childpages', 'wpb_list_child_pages');

and insert this code snippet into the file of an active theme:

<?php wpb_list_child_pages(); ?>

Can be improved suggested code?
Source: https://www.hostinger.com/tutorials/parent-page-wordpress

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