Merge pull request #24111 from alerobertson/add/tag-operator-shortcode

Add tag_operator to products shortcode
This commit is contained in:
Claudio Sanches 2019-07-09 15:37:43 -03:00 committed by GitHub
commit da00ef76cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -125,6 +125,7 @@ class WC_Shortcode_Products {
'terms' => '', // Comma separated term slugs or ids.
'terms_operator' => 'IN', // Operator to compare terms. Possible values are 'IN', 'NOT IN', 'AND'.
'tag' => '', // Comma separated tag slugs.
'tag_operator' => 'IN', // Operator to compare tags. Possible values are 'IN', 'NOT IN', 'AND'.
'visibility' => 'visible', // Product visibility setting. Possible values are 'visible', 'catalog', 'search', 'hidden'.
'class' => '', // HTML class.
'page' => 1, // Page for pagination.
@ -369,7 +370,7 @@ class WC_Shortcode_Products {
'taxonomy' => 'product_tag',
'terms' => array_map( 'sanitize_title', explode( ',', $this->attributes['tag'] ) ),
'field' => 'slug',
'operator' => 'IN',
'operator' => $this->attributes['tag_operator'],
);
}
}