Guest User

Untitled

a guest
Jan 24th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <php?
  2. function mynew_product_subcategories( $args = array() ) {
  3. $parentid = get_queried_object_id();
  4. $args = array(
  5. 'parent' => $parentid
  6. );
  7. $terms = get_terms( 'product_cat', $args );
  8. if ( $terms ) {
  9. echo '<ul class="product-cats">';
  10. foreach ( $terms as $term ) {
  11. echo '<li class="category">';
  12. woocommerce_subcategory_thumbnail( $term );
  13. echo '<h2>';
  14. echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
  15. echo $term->name;
  16. echo '</a>';
  17. echo '</h2>';
  18. echo '</li>';
  19. }
  20. echo '</ul>';
  21. }
  22. }
  23.  
  24. add_action( 'woocommerce_before_shop_loop', 'mynew_product_subcategories', 50 );
  25. ?>
Add Comment
Please, Sign In to add comment