Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- 子カテゴリーをサムネイル付きで一覧表示 -->
- <div class="boxline">
- <ul class="posts-listing">
- <?php
- $children = get_term_children($cat, 'category');
- // ***子カテゴリーをサムネイル付で一覧
- foreach($children as $child_id):
- $cnt++;
- $c_cat = get_category($child_id);
- if ($cat !== $c_cat->parent) {continue; /* 孫を除外 */ }
- ?>
- <!-- 子カテゴリー単体表示ブロック -->
- <li>
- <a href="<?php echo get_category_link($c_cat->cat_ID) ?>">
- <?php
- // カテゴリーのアイキャッチ画像を表示する
- $image = get_field('category-image', 'category_' . $c_cat->term_id);
- echo wp_get_attachment_image($image['id'], 'thumb230');
- ?>
- </a>
- <a href="<?php echo get_category_link($c_cat->cat_ID) ?>">
- <?php echo $c_cat->cat_name; ?>
- </a>
- </li>
- <!-- 子カテゴリー単体表示ブロック終了 -->
- <?php endforeach; ?>
- </ul>
- <div style="clear:both;"></div>
- </div>
- <!-- 子カテゴリーをサムネイル付きで一覧表示ここまで -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement