| @@ 839-848 (lines=10) @@ | ||
| 836 | * @access private |
|
| 837 | */ |
|
| 838 | private static function _maybe_add_category_args( $args, $category, $operator ) { |
|
| 839 | if ( ! empty( $category ) ) { |
|
| 840 | $args['tax_query'] = array( |
|
| 841 | array( |
|
| 842 | 'taxonomy' => 'product_cat', |
|
| 843 | 'terms' => array_map( 'sanitize_title', explode( ',', $category ) ), |
|
| 844 | 'field' => 'slug', |
|
| 845 | 'operator' => $operator |
|
| 846 | ) |
|
| 847 | ); |
|
| 848 | } |
|
| 849 | ||
| 850 | return $args; |
|
| 851 | } |
|
| @@ 690-699 (lines=10) @@ | ||
| 687 | 'meta_query' => array(), |
|
| 688 | ); |
|
| 689 | ||
| 690 | if ( ! empty( $args['type'] ) ) { |
|
| 691 | $types = explode( ',', $args['type'] ); |
|
| 692 | $query_args['tax_query'] = array( |
|
| 693 | array( |
|
| 694 | 'taxonomy' => 'product_type', |
|
| 695 | 'field' => 'slug', |
|
| 696 | 'terms' => $types, |
|
| 697 | ), |
|
| 698 | ); |
|
| 699 | } |
|
| 700 | ||
| 701 | // Filter products by category |
|
| 702 | if ( ! empty( $args['category'] ) ) { |
|