<ul> <?php wp_list_categories('orderby=id&show_count=1
&use_desc_for_title=0&child_of=2&title_li='); ?></ul>

投稿数いらなければ

<ul> <?php wp_list_categories('orderby=id
&use_desc_for_title=0&child_of=2&title_li='); ?></ul>

 親カテゴリで、子カテゴリ名+記事一覧の取得方法

<?php $cat_info = get_the_category();
$cat_term = $cat_info[0] -> category_parent;
$cat_info = get_categories('child_of='.$cat_term.'&orderby=order');
foreach ($cat_info as $category) { if($category->count != 0) : ?>
<h2><?php echo $category->cat_name; ?>のページ一覧</h2>
<ul>
<?php query_posts('posts_per_page=-1&order=ASC&category__in='.$category->term_id);
if (have_posts()) : while (have_posts()) : the_post();
?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;wp_reset_query();endif;endif; ?>
</ul>
<?php }; ?>

 

 

参考サイト mellowchanter.info…

ある特定の親カテゴリーに属している子カテゴリーのみ表示

カテゴリーID5に属しているカテゴリーのみ表示

<?php
wp_list_categories('child_of=5');
?>

 

参考サイト www.saka-en.com…
見ていただいてありがとうございます。↓ポチしてくださいませ。
  • 見た (4)
  • もう少し詳しく書いて! (3)
  • 見たけど役立たず (2)