Merge pull request #19412 from woocommerce/update/19408
Use wc_get_default_products_per_row as the default for product shortcodes
This commit is contained in:
commit
e6a266e30f
|
@ -113,7 +113,7 @@ class WC_Shortcode_Products {
|
|||
$attributes = shortcode_atts(
|
||||
array(
|
||||
'limit' => '-1', // Results limit.
|
||||
'columns' => '3', // Number of columns.
|
||||
'columns' => '', // Number of columns.
|
||||
'rows' => '', // Number of rows. If defined, limit will be ignored.
|
||||
'orderby' => 'title', // menu_order, title, date, rand, price, popularity, rating, or id.
|
||||
'order' => 'ASC', // ASC or DESC.
|
||||
|
@ -134,7 +134,7 @@ class WC_Shortcode_Products {
|
|||
);
|
||||
|
||||
if ( ! absint( $attributes['columns'] ) ) {
|
||||
$attributes['columns'] = 3;
|
||||
$attributes['columns'] = wc_get_default_products_per_row();
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
|
|
|
@ -14,7 +14,7 @@ class WC_Test_Shortcode_Products extends WC_Unit_Test_Case {
|
|||
$shortcode = new WC_Shortcode_Products();
|
||||
$expected = array(
|
||||
'limit' => '-1',
|
||||
'columns' => '3',
|
||||
'columns' => '4',
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'ids' => '',
|
||||
|
@ -40,7 +40,7 @@ class WC_Test_Shortcode_Products extends WC_Unit_Test_Case {
|
|||
) );
|
||||
$expected2 = array(
|
||||
'limit' => '-1',
|
||||
'columns' => '3',
|
||||
'columns' => '4',
|
||||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
'ids' => '',
|
||||
|
|
Loading…
Reference in New Issue