To display child pages on a parent page in WordPress just edit theme’s functions.php file and and the following code:
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 = '</code> <ul>' . $childpages . '</ul> '; } return $string; } add_shortcode('wpb_childpages', 'wpb_list_child_pages');
Then add the [wpb_childpages]
shortcode wherever you need to display child pages. ;)
If you need to Display Child Pages Without Any Shortcode dinamically, you need to add this line of code where you want to display child pages:
The theme will now automatically detect child pages and display them.
Doświadczony Programista WordPress Developer, od 2007 tworzy wielojęzykowe, responsywne witryny, sklepy internetowe, strony AMP oraz aplikacje mobilne, modyfikując frontend jak i backend serwisów pod indywidualne potrzeby klienta. Projektuje mikroanimacje i architekturę informacji w witrynach, optymalizuje kod witryny pod SEO. Łata dziury w oprogramowaniu, zabezpiecza i naprawia serwisy www po włamaniach. Od 1996r. tworzy strony www i kampanie online, a od 2007 roku migruje i kastomizuje strony klientów do WordPressa, szkoli, doradza i optymalizuje nakłady inwestycyjne na nowoczesne rozwiązania komunikacyjne w marketingu internetowym.