Fix - [products] ids and sku args.

Closes #7365
This commit is contained in:
Mike Jolley 2015-02-11 17:21:53 +00:00
parent 44aa8339b2
commit 334ee4c108
2 changed files with 10 additions and 6 deletions

View File

@ -350,7 +350,9 @@ class WC_Shortcodes {
$atts = shortcode_atts( array( $atts = shortcode_atts( array(
'columns' => '4', 'columns' => '4',
'orderby' => 'title', 'orderby' => 'title',
'order' => 'asc' 'order' => 'asc',
'ids' => '',
'skus' => ''
), $atts ); ), $atts );
$meta_query = WC()->query->get_meta_query(); $meta_query = WC()->query->get_meta_query();
@ -365,7 +367,7 @@ class WC_Shortcodes {
'meta_query' => $meta_query 'meta_query' => $meta_query
); );
if ( isset( $atts['skus'] ) ) { if ( ! empty( $atts['skus'] ) ) {
$skus = explode( ',', $atts['skus'] ); $skus = explode( ',', $atts['skus'] );
$skus = array_map( 'trim', $skus ); $skus = array_map( 'trim', $skus );
$args['meta_query'][] = array( $args['meta_query'][] = array(
@ -375,7 +377,7 @@ class WC_Shortcodes {
); );
} }
if ( isset( $atts['ids'] ) ) { if ( ! empty( $atts['ids'] ) ) {
$ids = explode( ',', $atts['ids'] ); $ids = explode( ',', $atts['ids'] );
$ids = array_map( 'trim', $ids ); $ids = array_map( 'trim', $ids );
$args['post__in'] = $ids; $args['post__in'] = $ids;
@ -938,9 +940,10 @@ class WC_Shortcodes {
'posts_per_page' => '2', 'posts_per_page' => '2',
'columns' => '2', 'columns' => '2',
'orderby' => 'rand', 'orderby' => 'rand',
'per_page' => ''
), $atts ); ), $atts );
if ( isset( $atts['per_page'] ) ) { if ( ! empty( $atts['per_page'] ) ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', __( 'Use $args["posts_per_page"] instead. Deprecated argument will be removed in WC 2.2.', 'woocommerce' ) ); _deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', __( 'Use $args["posts_per_page"] instead. Deprecated argument will be removed in WC 2.2.', 'woocommerce' ) );
$atts['posts_per_page'] = $atts['per_page']; $atts['posts_per_page'] = $atts['per_page'];
unset( $atts['per_page'] ); unset( $atts['per_page'] );

View File

@ -141,6 +141,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - When the geolocation database cannot download, ensure the correct method is used to log the error. * Fix - When the geolocation database cannot download, ensure the correct method is used to log the error.
* Fix - Notice in woocommerce_form_field(). * Fix - Notice in woocommerce_form_field().
* Fix - attribute_public notice before DB upgrade. * Fix - attribute_public notice before DB upgrade.
* Fix - [products] ids and sku args.
= 2.3.0 - 11/02/2015 = = 2.3.0 - 11/02/2015 =
* Feature - Option to geo-locate the customer's inital location. * Feature - Option to geo-locate the customer's inital location.