Advertisement
Guest User

Untitled

a guest
Aug 18th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <!-- 子カテゴリーをサムネイル付きで一覧表示 -->
  2. <div class="boxline">
  3. <ul class="posts-listing">
  4. <?php
  5. $children = get_term_children($cat, 'category');
  6.  
  7. // ***子カテゴリーをサムネイル付で一覧
  8. foreach($children as $child_id):
  9. $cnt++;
  10. $c_cat = get_category($child_id);
  11. if ($cat !== $c_cat->parent) {continue; /* 孫を除外 */ }
  12. ?>
  13.  
  14. <!-- 子カテゴリー単体表示ブロック -->
  15. <li>
  16. <a href="<?php echo get_category_link($c_cat->cat_ID) ?>">
  17. <?php
  18. // カテゴリーのアイキャッチ画像を表示する
  19. $image = get_field('category-image', 'category_' . $c_cat->term_id);
  20. echo wp_get_attachment_image($image['id'], 'thumb230');
  21. ?>
  22. </a>
  23. <a href="<?php echo get_category_link($c_cat->cat_ID) ?>">
  24. <?php echo $c_cat->cat_name; ?>
  25. </a>
  26. </li>
  27. <!-- 子カテゴリー単体表示ブロック終了 -->
  28. <?php endforeach; ?>
  29. </ul>
  30. <div style="clear:both;"></div>
  31. </div>
  32. <!-- 子カテゴリーをサムネイル付きで一覧表示ここまで -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement