WC_Shortcodes implements Registerable, JsonSerializable
Adds integration for WC Shortcodes.
Interfaces, Classes and Traits
- Registerable
- JsonSerializable
Table of Contents
- $types : array<string|int, mixed>
- List of supported WC shortcodes.
- $show_notice : mixed
- add_close_tags() : void
- Close the shortcode wrapper div element and inject the required html comment for the ajax request.
- add_closing_tag() : void
- Add the closing tag from our display service.
- add_flags() : array<string|int, mixed>
- Add filtering flags to the shortcodes.
- add_opening_tag() : void
- Add the opening tag from our display service.
- add_tags() : void
- Wraps the output of the [products] shortcode with a custom div and generate our fallback elements for prefilling.
- adjust_found_posts_logic() : int
- Adjust the logic for the found posts count.
- assets() : void
- Load the assets specific to this integration.
- catch_page() : void
- Disable our query wrappers on page load.
- disable_wp_query_wrapper() : void
- Disable the original query wrapper.
- generate_fallback_output() : void
- Generates the output of our fallback elements.
- jsonSerialize() : array<string|int, mixed>
- Prepare fallback json array.
- register() : void
- Register the integration.
- detect_running_action() : string|false
- Detect the running action.
- has_wc_shortcode() : bool
- Determine if the page has at least one of the supported shortcodes.
- show_compatibility_notice() : void
- Show a notice to the user if the cache attribute is set to true.
Properties
$types
List of supported WC shortcodes.
public
array<string|int, mixed>
$types
= ['recent_products', 'products', 'sale_products', 'best_selling_products', 'top_rated_products', 'featured_products']
$show_notice
protected
mixed
$show_notice
Methods
add_close_tags()
Close the shortcode wrapper div element and inject the required html comment for the ajax request.
public
add_close_tags(array<string|int, mixed> $attributes) : void
Parameters
- $attributes : array<string|int, mixed>
Return values
void —add_closing_tag()
Add the closing tag from our display service.
public
add_closing_tag() : void
Return values
void —add_flags()
Add filtering flags to the shortcodes.
public
add_flags(array<string|int, mixed> $args, array<string|int, mixed> $attributes, string $type) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
- $attributes : array<string|int, mixed>
- $type : string
Return values
array<string|int, mixed> —add_opening_tag()
Add the opening tag from our display service.
public
add_opening_tag() : void
Return values
void —add_tags()
Wraps the output of the [products] shortcode with a custom div and generate our fallback elements for prefilling.
public
add_tags(array<string|int, mixed> $attributes) : void
Parameters
- $attributes : array<string|int, mixed>
Return values
void —adjust_found_posts_logic()
Adjust the logic for the found posts count.
public
adjust_found_posts_logic(int $found, WP_Query $the_query) : int
'found_posts' is not always accurate when using the [products] shortcode. This is because the shortcode uses the 'no_found_rows' parameter to improve performance.
Parameters
- $found : int
- $the_query : WP_Query
Return values
int —assets()
Load the assets specific to this integration.
public
assets() : void
Return values
void —catch_page()
Disable our query wrappers on page load.
public
catch_page() : void
Return values
void —disable_wp_query_wrapper()
Disable the original query wrapper.
public
disable_wp_query_wrapper() : void
Return values
void —generate_fallback_output()
Generates the output of our fallback elements.
public
generate_fallback_output(array<string|int, mixed> $products) : void
Parameters
- $products : array<string|int, mixed>
Return values
void —jsonSerialize()
Prepare fallback json array.
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —register()
Register the integration.
public
register() : void
Return values
void —detect_running_action()
Detect the running action.
private
detect_running_action() : string|false
Return values
string|false —has_wc_shortcode()
Determine if the page has at least one of the supported shortcodes.
private
has_wc_shortcode() : bool
Return values
bool —show_compatibility_notice()
Show a notice to the user if the cache attribute is set to true.
private
show_compatibility_notice() : void