按字母顺序对 Wordpress 列表进行排序

Sort Wordpress list alphabetically

我将以下代码与 ACF 结合使用来列出当前页面的子页面。

我可以强制按字母顺序列出吗?

<?php
                    $this_page_id=$wp_query->post->ID;;
                    $args=array(
                      'post_parent' => $this_page_id,
                      'post_type' => 'page',
                      'orderby' => 'the_title',
                    );
                    $my_query = null;
                    $my_query = new WP_Query($args);
                    if( $my_query->have_posts() ) { ?>
                            <ul>
                    <?php
                      while ($my_query->have_posts()) : $my_query->the_post(); ?>
                                <li><h4><a href="<?php the_permalink() ?>">
                                <?php $brand_name  = get_post_meta($post->ID, 'brand_name', true); ?>
                                <?php echo $brand_name; ?>
                                </a></h4>
                            </li>
                       <?php endwhile; } else {?>
                        <h1>Sorry we have no documentation available.</h1>
                         <?php } ?>
                        </ul>
                    <?php wp_reset_query();?>

这可能是骗人的,但我看到的标记与我所拥有的不同,我无法弄清楚如何让它发挥作用。

将the_title更改为

中的标题
$args=array(
   'post_parent' => $this_page_id,
   'post_type' => 'page',
   'orderby' => 'title ', //changed
   'order' => 'ASC', // updated
);

title 是 WP 中的默认排序参数之一,您可以看到它们 here