WC_Shortcode_Products::parse_attributes( array $attributes )
Parse attributes.
Description Description
Parameters Parameters
- $attributes
-
(Required) Shortcode attributes.
Return Return
(array)
Source Source
File: includes/shortcodes/class-wc-shortcode-products.php
protected function parse_attributes( $attributes ) { $attributes = $this->parse_legacy_attributes( $attributes ); $attributes = shortcode_atts( array( 'limit' => '-1', // Results limit. 'columns' => '', // Number of columns. 'rows' => '', // Number of rows. If defined, limit will be ignored. 'orderby' => '', // menu_order, title, date, rand, price, popularity, rating, or id. 'order' => '', // ASC or DESC. 'ids' => '', // Comma separated IDs. 'skus' => '', // Comma separated SKUs. 'category' => '', // Comma separated category slugs or ids. 'cat_operator' => 'IN', // Operator to compare categories. Possible values are 'IN', 'NOT IN', 'AND'. 'attribute' => '', // Single attribute slug. '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. 'paginate' => false, // Should results be paginated. 'cache' => true, // Should shortcode output be cached. ), $attributes, $this->type ); if ( ! absint( $attributes['columns'] ) ) { $attributes['columns'] = wc_get_default_products_per_row(); } return $attributes; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |