WooCommerce Code Reference

WC_Widget_Brand_Nav extends WC_Widget
in package

Layered Navigation Widget for brands WC 2.6 version

Important: For internal use only by the Automattic\WooCommerce\Internal\Brands package.

Tags
version
9.4.0
extends

WP_Widget

Table of Contents

$settings  : array<string|int, mixed>
Settings.
$widget_cssclass  : string
CSS class.
$widget_description  : string
Widget description.
$widget_id  : string
Widget ID.
$widget_name  : string
Widget name.
__construct()  : void
Constructor
cache_widget()  : string
Cache the widget.
filter_out_cats()  : mixed
Filter out all categories and not display them
flush_widget_cache()  : mixed
Flush the cache.
form()  : void
Form function.
get_cached_widget()  : bool
Get cached widget.
get_chosen_attributes()  : array<string|int, mixed>
Gets the currently selected attributes
update()  : array<string|int, mixed>
Update function.
widget()  : void
Widget function.
widget_end()  : mixed
Output the html at the end of a widget.
widget_start()  : mixed
Output the html at the start of a widget.
get_current_page_url()  : string
Get current page URL with various filtering props supported by WC.
get_current_taxonomy()  : string
Return the currently viewed taxonomy name.
get_current_term_id()  : int
Return the currently viewed term ID.
get_current_term_slug()  : int
Return the currently viewed term slug.
get_filtered_term_product_counts()  : array<string|int, mixed>
Count products within certain terms, taking the main WP query into consideration.
get_instance_title()  : string
Get this widgets title.
get_page_base_url()  : string
Get current page URL for layered nav items.
get_widget_id_for_cache()  : string
Get widget id plus scheme/protocol to prevent serving mixed content from (persistently) cached widgets.
layered_nav_dropdown()  : bool
Show dropdown layered nav.
layered_nav_list()  : bool
Show list based layered nav.

Properties

Methods

cache_widget()

Cache the widget.

public cache_widget(array<string|int, mixed> $args, string $content) : string
Parameters
$args : array<string|int, mixed>

Arguments.

$content : string

Content.

Return values
stringthe content that was cached

filter_out_cats()

Filter out all categories and not display them

public filter_out_cats(array<string|int, mixed> $cat_args) : mixed
Parameters
$cat_args : array<string|int, mixed>

Category arguments.

Return values
mixed

form()

Form function.

public form(array<string|int, mixed> $instance) : void
Parameters
$instance : array<string|int, mixed>

Widget instance.

Tags
see

WP_Widget->form

Return values
void

get_cached_widget()

Get cached widget.

public get_cached_widget(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

Arguments.

Return values
booltrue if the widget is cached otherwise false

update()

Update function.

public update(array<string|int, mixed> $new_instance, array<string|int, mixed> $old_instance) : array<string|int, mixed>
Parameters
$new_instance : array<string|int, mixed>

The new settings for the particular instance of the widget.

$old_instance : array<string|int, mixed>

The old settings for the particular instance of the widget.

Tags
see

WP_Widget->update

Return values
array<string|int, mixed>

widget()

Widget function.

public widget(array<string|int, mixed> $args, array<string|int, mixed> $instance) : void
Parameters
$args : array<string|int, mixed>

Arguments.

$instance : array<string|int, mixed>

Widget instance.

Tags
see
WP_Widget
Return values
void

widget_end()

Output the html at the end of a widget.

public widget_end(array<string|int, mixed> $args) : mixed
Parameters
$args : array<string|int, mixed>

Arguments.

Return values
mixed

widget_start()

Output the html at the start of a widget.

public widget_start(array<string|int, mixed> $args, array<string|int, mixed> $instance) : mixed
Parameters
$args : array<string|int, mixed>

Arguments.

$instance : array<string|int, mixed>

Instance.

Return values
mixed

get_current_page_url()

Get current page URL with various filtering props supported by WC.

protected get_current_page_url() : string
Tags
since
3.3.0
Return values
string

get_filtered_term_product_counts()

Count products within certain terms, taking the main WP query into consideration.

protected get_filtered_term_product_counts(array<string|int, mixed> $term_ids, string $taxonomy[, string $query_type = 'and' ]) : array<string|int, mixed>
Parameters
$term_ids : array<string|int, mixed>

Term IDs.

$taxonomy : string

Taxonomy.

$query_type : string = 'and'

Query type.

Return values
array<string|int, mixed>

get_instance_title()

Get this widgets title.

protected get_instance_title(array<string|int, mixed> $instance) : string
Parameters
$instance : array<string|int, mixed>

Array of instance options.

Return values
string

get_page_base_url()

Get current page URL for layered nav items.

protected get_page_base_url(string $taxonomy) : string
Parameters
$taxonomy : string

Taxonomy.

Return values
string

get_widget_id_for_cache()

Get widget id plus scheme/protocol to prevent serving mixed content from (persistently) cached widgets.

protected get_widget_id_for_cache(string $widget_id[, string $scheme = '' ]) : string
Parameters
$widget_id : string

Id of the cached widget.

$scheme : string = ''

Scheme for the widget id.

Tags
since
3.4.0
Return values
stringWidget id including scheme/protocol.

layered_nav_dropdown()

Show dropdown layered nav.

protected layered_nav_dropdown(array<string|int, mixed> $terms, string $taxonomy, int $depth) : bool
Parameters
$terms : array<string|int, mixed>

Terms.

$taxonomy : string

Taxonomy.

$depth : int

Depth.

Return values
boolWill nav display?

layered_nav_list()

Show list based layered nav.

protected layered_nav_list(array<string|int, mixed> $terms, string $taxonomy, int $depth) : bool
Parameters
$terms : array<string|int, mixed>

Terms.

$taxonomy : string

Taxonomy.

$depth : int

Depth.

Return values
boolWill nav display?