Create a loop that gets pages with their template
The snippet from codex is a bit redundant in your case. You can achieve what you need, by using snippets like these: index.php $mainpage = get_page_by_title( ‘ROOT’ ); $the_query = new WP_Query( array( ‘post_parent’ => $mainpage->ID, ‘post_type’ => ‘page’, ) ); $index = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<section class=”page’ . get_the_ID() … Read more