I'm looking to make a page template, which, if the page is a parent of children pages, then display them as an ordered list.
I would preferably like to do this as a loop.
Any ideas, holler.
Thanks.
First set your arguments(settings)
$args = array(
'post_parent' => get_the_ID(),
'post_type' => 'page',
'numberposts' => -1,
'post_status' => 'publish'
);
$children = get_children( $args, $output );
then you can use something like this
<?php if (!empty($children)):?>
<ul class="row">
<?php foreach($children as $dest){
$permalink = get_permalink($dest->ID);
echo "<li class='col-sm-4'><a href='{$permalink}'>" . $dest->post_title . "</li>";
}?>
</ul>
<?php endif;?>
For more info https://codex.wordpress.org/Function_Reference/get_children