woocommerce_template_loop_category_link_open()
Insert the opening anchor tag for categories in the loop.
No Hooks.
Returns
null. Nothing (null).
Usage
woocommerce_template_loop_category_link_open( $category );
- $category(int|object|string) (required)
- Category ID, Object or String.
woocommerce_template_loop_category_link_open() woocommerce template loop category link open code WC 10.6.2
function woocommerce_template_loop_category_link_open( $category ) {
$category_term = get_term( $category, 'product_cat' );
$category_name = ( ! $category_term || is_wp_error( $category_term ) ) ? '' : $category_term->name;
/* translators: %s: Category name */
echo '<a aria-label="' . sprintf( esc_attr__( 'Visit product category %1$s', 'woocommerce' ), esc_attr( $category_name ) ) . '" href="' . esc_url( get_term_link( $category, 'product_cat' ) ) . '">';
}