Site logo

Archived topic

Niche Template ( Woocommerce Nav )

3 replies · Started by FunkyCss on December 13, 2020

Viewing posts 1–4 of 4

Hi, there is any way in the template of Niche to display in the custom woocommerce nav of the products to display the tags so to make it like filtering?

Thank you in advance

Hi there,

should be as simple as swapping out the category terms for tag terms like so:

<?php
$tag_args = array(
    'orderby'    => 'name',
    'order'      => 'asc',
    'hide_empty' => true,
);
 
$product_tags = get_terms( 'product_cat', $cat_args );
 
if ( ! empty( $product_tags ) ) {
    echo '<ul class="woo-cat-nav">';
	foreach ( $product_tags as $key => $tag ) {
	    printf( 
	    '<li>
		<a href="%1$s">
		%2$s
		</a>
	     </li>',
		get_term_link( $tag ),
		$tag->name
	    );
	}
    echo '</ul>';
}
?>

Hi Thank you it works!

Awesome - glad to be of help

This archived topic is closed to new replies.