Guest User

Untitled

a guest
Feb 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Category A
  2. Category A1
  3. Category A2
  4. Category A3
  5.  
  6. if ( have_posts() ) {
  7. do_action( 'woocommerce_before_shop_loop' );
  8. woocommerce_product_loop_start();
  9.  
  10. if ( wc_get_loop_prop( 'total' ) ) {
  11.  
  12. while ( have_posts() ) {
  13. the_post();
  14.  
  15. // here I filter the products from specific category
  16. global $post;
  17. $skip = false;
  18. $terms = wp_get_post_terms( $post->ID, 'product_cat' );
  19. foreach ( $terms as $term ) {
  20. if(substr( $term->slug, 0, 7 ) === "zubehor") {
  21. $skip = true;
  22. break;
  23. }
  24. }
  25.  
  26. if($skip)
  27. continue;
  28.  
  29. do_action( 'woocommerce_shop_loop' );
  30. wc_get_template_part( 'content', 'product' );
  31. }
  32. }
  33.  
  34. woocommerce_product_loop_end();
  35. do_action( 'woocommerce_after_shop_loop' );
  36. }
Add Comment
Please, Sign In to add comment