Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. // $list_subcat = get_terms( ['taxonomy' => 'category', 'hide_empty' => false, 'parent' => $cat] );
  3. // $list_subcat = get_categories( ['hide_empty' => false, 'parent' => $cat] );
  4.  
  5. $list_subcat = array();
  6. if ( !empty($cat) ) $list_subcat = get_categories( ['hide_empty' => false, 'parent' => $cat] );
  7.  
  8. if ( count($list_subcat)):
  9.  
  10. echo "<div class='subcat'>";
  11. foreach ($list_subcat as $item_subcat) {
  12.  
  13. $category_link = get_category_link( $item_subcat->term_id );
  14.  
  15. echo '<div>';
  16. echo '<h3><a href="'.$category_link.'">'.$item_subcat->name.'</a></h3>';
  17. echo '<div><a href="'.$category_link.'">'.$item_subcat->description.'</a></div>';
  18. echo '</div>';
  19. }
  20. echo "</div>";
  21.  
  22. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement