Custom loop ordering not working

Question

I have a custom loop to display the children of a parent page which works well – however, I cant get the ordering of the items to work as I want – I want them to appear in alphabetical order (A>Z). Can anyone help with some mods to the code below to get it to work as I want it?

<?php
$ids = array();
$pages = get_pages("parent=".$post->ID);
if ($pages) {
    foreach ($pages as $page) {
        $ids[] = $page->ID;
    }
}
$paged = (get_query_var("paged")) ? get_query_var("paged") : 1;
$args = array(
    "paged" => $paged,
    "post__in" => $ids,
    "posts_per_page" => 600,
    "post_type" => "page",
    "sort_order" => "ASC",
    "sort_column" => "post_name"
);
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post(); 
?>

0
Jdubbs 5 months 2022-03-21T05:47:11-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse