Site logo

Archived topic

Premium theme "niche" - How can i create this shop menu?

3 replies · Started by infotbd on November 23, 2021

Viewing posts 1–4 of 4

Hello all,

how can i create/edit my shop site that i get this menu in the shop site itself:
https://ibb.co/pLTc98f

I mean "Albums", "Clothing" ....

Hi there,

It involves adding some php code into a hook element:
https://www.screencast.com/t/oMGcI0jVNar9

1. Create a hook element at appearance > elements.

2. Add the below code into the content area:

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

3. Choose Woocommerce_archive_description hook, set location according to your needs:
https://www.screencast.com/t/TkYmsNjTG

Once it's done, you might need some custom CSS to style the category menu.

Let me know if this helps :)

It is working! Great! Thanks you!!

You are welcome :)

This archived topic is closed to new replies.