WC_Shortcode_Products
in package
Products shortcode class.
Table of Contents
- $attributes : array<string|int, mixed>
- Attributes.
- $custom_visibility : bool
- Set custom visibility.
- $query_args : array<string|int, mixed>
- Query args.
- $type : string
- Shortcode type.
- __construct() : mixed
- Initialize shortcode.
- get_attributes() : array<string|int, mixed>
- Get shortcode attributes.
- get_content() : string
- Get shortcode content.
- get_query_args() : array<string|int, mixed>
- Get query args.
- get_type() : string
- Get shortcode type.
- order_by_rating_post_clauses() : array<string|int, mixed>
- Order by rating.
- set_product_as_visible() : bool
- Set product as visible when querying for hidden products.
- get_query_results() : object
- Run the query and return an array of data, including queried ids and pagination information.
- get_transient_name() : string
- Generate and return the transient name for this shortcode based on the query args.
- get_wrapper_classes() : array<string|int, mixed>
- Get wrapper classes.
- parse_attributes() : array<string|int, mixed>
- Parse attributes.
- parse_legacy_attributes() : array<string|int, mixed>
- Parse legacy attributes.
- parse_query_args() : array<string|int, mixed>
- Parse query args.
- product_loop() : string
- Loop over found products.
- set_attributes_query_args() : mixed
- Set attributes query args.
- set_best_selling_products_query_args() : mixed
- Set best selling products query args.
- set_categories_query_args() : mixed
- Set categories query args.
- set_ids_query_args() : mixed
- Set ids query args.
- set_sale_products_query_args() : mixed
- Set sale products query args.
- set_skus_query_args() : mixed
- Set skus query args.
- set_tags_query_args() : mixed
- Set tags query args.
- set_top_rated_products_query_args() : mixed
- Set top rated products query args.
- set_visibility_catalog_query_args() : mixed
- Set visibility as catalog.
- set_visibility_featured_query_args() : mixed
- Set visibility as featured.
- set_visibility_hidden_query_args() : mixed
- Set visibility as hidden.
- set_visibility_query_args() : mixed
- Set visibility query args.
- set_visibility_search_query_args() : mixed
- Set visibility as search.
Properties
$attributes
Attributes.
protected
array<string|int, mixed>
$attributes
= array()
Tags
$custom_visibility
Set custom visibility.
protected
bool
$custom_visibility
= alse
Tags
$query_args
Query args.
protected
array<string|int, mixed>
$query_args
= array()
Tags
$type
Shortcode type.
protected
string
$type
= 'products'
Tags
Methods
__construct()
Initialize shortcode.
public
__construct([array<string|int, mixed> $attributes = array() ][, string $type = 'products' ]) : mixed
Parameters
- $attributes : array<string|int, mixed> = array()
-
Shortcode attributes.
- $type : string = 'products'
-
Shortcode type.
Tags
Return values
mixed —get_attributes()
Get shortcode attributes.
public
get_attributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_content()
Get shortcode content.
public
get_content() : string
Tags
Return values
string —get_query_args()
Get query args.
public
get_query_args() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_type()
Get shortcode type.
public
get_type() : string
Tags
Return values
string —order_by_rating_post_clauses()
Order by rating.
public
static order_by_rating_post_clauses(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
-
Query args.
Tags
Return values
array<string|int, mixed> —set_product_as_visible()
Set product as visible when querying for hidden products.
public
set_product_as_visible(bool $visibility) : bool
Parameters
- $visibility : bool
-
Product visibility.
Tags
Return values
bool —get_query_results()
Run the query and return an array of data, including queried ids and pagination information.
protected
get_query_results() : object
Tags
Return values
object — Object with the following props; ids, per_page, found_posts, max_num_pages, current_pageget_transient_name()
Generate and return the transient name for this shortcode based on the query args.
protected
get_transient_name() : string
Tags
Return values
string —get_wrapper_classes()
Get wrapper classes.
protected
get_wrapper_classes(int $columns) : array<string|int, mixed>
Parameters
- $columns : int
-
Number of columns.
Tags
Return values
array<string|int, mixed> —parse_attributes()
Parse attributes.
protected
parse_attributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
-
Shortcode attributes.
Tags
Return values
array<string|int, mixed> —parse_legacy_attributes()
Parse legacy attributes.
protected
parse_legacy_attributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
-
Attributes.
Tags
Return values
array<string|int, mixed> —parse_query_args()
Parse query args.
protected
parse_query_args() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —product_loop()
Loop over found products.
protected
product_loop() : string
Tags
Return values
string —set_attributes_query_args()
Set attributes query args.
protected
set_attributes_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_best_selling_products_query_args()
Set best selling products query args.
protected
set_best_selling_products_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_categories_query_args()
Set categories query args.
protected
set_categories_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_ids_query_args()
Set ids query args.
protected
set_ids_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_sale_products_query_args()
Set sale products query args.
protected
set_sale_products_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_skus_query_args()
Set skus query args.
protected
set_skus_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_tags_query_args()
Set tags query args.
protected
set_tags_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_top_rated_products_query_args()
Set top rated products query args.
protected
set_top_rated_products_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_visibility_catalog_query_args()
Set visibility as catalog.
protected
set_visibility_catalog_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_visibility_featured_query_args()
Set visibility as featured.
protected
set_visibility_featured_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_visibility_hidden_query_args()
Set visibility as hidden.
protected
set_visibility_hidden_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_visibility_query_args()
Set visibility query args.
protected
set_visibility_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.
Tags
Return values
mixed —set_visibility_search_query_args()
Set visibility as search.
protected
set_visibility_search_query_args(array<string|int, mixed> &$query_args) : mixed
Parameters
- $query_args : array<string|int, mixed>
-
Query args.