サポート » 使い方全般 » get_the_category()で親・子カテゴリの表示順が逆になってしまいます。

  • 表題の件ですが、indexテンプレート、<?php if ( is_home() ) { ?>ループの中で下記のコードにて、新着記事の一覧を表示させています。
    その中に、get_the_category()を用いて記事の親・子カテゴリを表示させているのですが、アルファベット順で「子・親カテゴリ」と並んでしまうものがあります。
    プラグインを利用しても「wp_list_categories()」にしか任意の順番が適用されず悩んでおります。
    Wpの仕様だと諦めるしかないのでしょうか?
    何か解決法などございましたら、ご教示いただければ幸いです。

    <!--▼Update Recods▼-->
    <div id="brandnew">
    <h2>Brandnew!</h2>
    <ul>
    
    <?php query_posts('showposts=5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <li>
    <span class="b_date"><?php the_date(); ?></span><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a> <span class="font_n">[</span>
    <?php
    foreach((get_the_category()) as $cat) {
    echo $cat->cat_name .' ';
    } ?>
    
     <?php echo get_post_meta($post->ID,"Rating Icon",true); ?>
    <span class="font_n">]</span>
    </li>
    <?php endwhile; endif; ?>
    </ul>
    </div>
    <!--▲Update Recods▲-->
  • トピック「get_the_category()で親・子カテゴリの表示順が逆になってしまいます。」には新たに返信することはできません。