WC_Shortcodes::product_attribute
List products with an attribute shortcode. Example [product_attribute attribute="color" filter="black"].
Метод класса: WC_Shortcodes{}
Хуков нет.
Возвращает
Строку.
Использование
$result = WC_Shortcodes::product_attribute( $atts );
- $atts(массив) (обязательный)
- Attributes.
Код WC_Shortcodes::product_attribute() WC Shortcodes::product attribute WC 10.7.0
public static function product_attribute( $atts ) {
$atts = array_merge(
array(
'limit' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'ASC',
'attribute' => '',
'terms' => '',
),
(array) $atts
);
if ( empty( $atts['attribute'] ) ) {
return '';
}
$shortcode = new WC_Shortcode_Products( $atts, 'product_attribute' );
return $shortcode->get_content();
}