WC_Brands::woocommerce_brands_update_layered_nav_link()
Injects Brands filters into layered nav links.
Метод класса: WC_Brands{}
Хуки из метода
Возвращает
Строку
. Term html.
Использование
$WC_Brands = new WC_Brands(); $WC_Brands->woocommerce_brands_update_layered_nav_link( $term_html, $term, $link, $count );
- $term_html(строка) (обязательный)
- Original link html.
- $term(разное) (обязательный)
- Term that is currently added.
- $link(строка) (обязательный)
- Original layered nav item link.
- $count(number) (обязательный)
- Number of items in that filter.
Код WC_Brands::woocommerce_brands_update_layered_nav_link() WC Brands::woocommerce brands update layered nav link WC 9.4.2
public function woocommerce_brands_update_layered_nav_link( $term_html, $term, $link, $count ) { if ( empty( $_GET['filter_product_brand'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return $term_html; } $filter_product_brand = wc_clean( wp_unslash( $_GET['filter_product_brand'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $current_attributes = array_map( 'intval', explode( ',', $filter_product_brand ) ); $current_values = ! empty( $current_attributes ) ? $current_attributes : array(); $link = add_query_arg( array( 'filtering' => '1', 'filter_product_brand' => implode( ',', $current_values ), ), wp_specialchars_decode( $link ) ); $term_html = '<a rel="nofollow" href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>'; $term_html .= ' ' . apply_filters( 'woocommerce_layered_nav_count', '<span class="count">(' . absint( $count ) . ')</span>', $count, $term ); return $term_html; }