wdtobibur

category list

Mar 1st, 2019
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4. $categories = get_the_category();
  5. $catID = $categories[0]->cat_ID;
  6. ?>
  7.  
  8. <?php
  9. $subcats = get_categories('child_of=' . $catID);
  10. foreach($subcats as $subcat) {
  11. echo '<h3>' . $subcat->cat_name . '</h3>';
  12. echo '<h2>'. $subcat->cat_name.'</h2>';
  13. print_r($subcat);
  14. echo '<ul>';
  15. $subcat_posts = get_posts('cat=' . $subcat->cat_ID);
  16. foreach($subcat_posts as $subcat_post) {
  17. print_r($subcat_post);
  18. $postID = $subcat_post->ID;
  19. echo '<li>';
  20. echo '<a href="' . get_permalink($postID) . '">';
  21. echo get_the_title($postID);
  22. echo '</a></li>';
  23. }
  24. echo '</ul>';
  25. } ?>
  26.  
  27.  
  28.  
  29. <?php
  30.  
  31. wp_list_categories( array(
  32. 'orderby' => 'id',
  33. 'current_category' => '1',
  34. 'show_count' => false,
  35. 'use_desc_for_title' => false,
  36. 'hide_empty' => 0,
  37. 'title_li' => __("Color:"),
  38. 'child_of' => 46
  39. ) );
  40. ?>
  41.  
  42. <?php
  43. wp_list_categories( array(
  44. 'orderby' => 'id',
  45. 'show_count' => false,
  46. 'use_desc_for_title' => false,
  47. 'title_li' => __("Design:"),
  48. 'child_of' => 48
  49. ) );
  50. ?>
  51. <?php
  52. wp_list_categories( array(
  53. 'orderby' => 'id',
  54. 'show_count' => false,
  55. 'use_desc_for_title' => false,
  56. 'title_li' => __("SERIES:"),
  57. 'child_of' => 43
  58. ) );
  59. ?>
  60.  
  61. <?php
  62. $categories = get_the_category();
  63. $catID = $categories[0]->cat_ID;
  64. $subcats = get_categories('child_of=' . $catID);
  65. foreach($subcats as $subcat) {
  66. echo '<h3>' . $subcat->cat_name . '</h3>';
  67. echo '<h2>'. $subcat->parent_name.'</h2>';
  68. }
  69. ?>
Add Comment
Please, Sign In to add comment