Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. // Get post category info
  2. $category = get_the_category();
  3.  
  4. if ( !empty( $category ) ) {
  5.  
  6. // Get last category post is in
  7. $last_category = end ( array_values( $category ) ); // Line 73
  8.  
  9. // Get parent any categories and create array
  10. $get_cat_parents = rtrim( get_category_parents ( $last_category->term_id, true, ',' ), ',' );
  11. $cat_parents = explode( ',', $get_cat_parents );
  12.  
  13. // Loop through parent categories and store in variable $cat_display
  14. $cat_display = '';
  15. foreach ( $cat_parents as $parents ) {
  16. $cat_display .= '<li class="item-cat">'.$parents.'</li>';
  17. $cat_display .= '<li class="breadcrumb-separator"> ' . $separator . ' </li>';
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement