Guest User

Untitled

a guest
Jun 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. class productsWalker extends Walker_Category {
  2.  
  3. function start_el(&$output, $category, $depth, $args) {
  4. extract($args);
  5.  
  6. $cat_name = esc_attr( $category->name );
  7. $cat_name = apply_filters( 'list_cats', $cat_name, $category );
  8. $link = '<a href="javascript:;" ';
  9. $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
  10. $link .= 'rel="'.$category->slug.'" ';
  11. $link .= 'class="product_sort">';
  12. $link .= $cat_name . '</a>';
  13. if ( 'list' == $args['style'] ) {
  14. $output .= "\t<li";
  15. $class = 'cat-item cat-item-' . $category->term_id;
  16. if ( !empty($current_category) ) {
  17. $_current_category = get_term( $current_category, $category->taxonomy );
  18. if ( $category->term_id == $current_category )
  19. $class .= ' current-cat';
  20. elseif ( $category->term_id == $_current_category->parent )
  21. $class .= ' current-cat-parent';
  22. }
  23. $output .= ' class="' . $class . '"';
  24. $output .= ">$link\n";
  25. } else {
  26. $output .= "\t$link<br />\n";
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment