2016-07-19 4 views
0

私は現在のページのサブページを一覧表示するためにACFと組み合わせて次のコードを使用しています。アルファベット順にWordpressのリストをソート

これを強制的にアルファベット順に表示できますか?

<?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();?> 

は、おそらくこれのdupesありますが、私が見ているもののマークアップは、私が持っているものと異なっていて、私はそれを動作させる方法を見つけ出すことができませんでした。

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

タイトルでタイトルへ

答えて

1

変更the_titleは、あなたがそれらをhere

+0

おかげで、また必要に応じてを見ることができるWPのデフォルトのソートパラメータの一つです。 'order' => 'ASC' –

関連する問題