Home Forums WoodMart support forum Delete the "categories" dropdown in the mobile version

Delete the "categories" dropdown in the mobile version

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #37100

    Antonio
    Participant

    Hi, I’m very happy with your template but I have no idea how to speak English.

    Delete the “categories” dropdown in the mobile version when the category that is being displayed does not have any child category.

    Add 2 screenshots to try to explain what I need to do on my website.

    I love what you are, keep working this well

    a greeting

    Attachments:
    You must be logged in to view attached files.
    #37122

    Artem Temos
    Keymaster

    Hello,

    We are glad to know that you considered using WoodMart for your web-site. I hope you will be happy with it.

    Try to add the following code snippet to the Custom CSS area for mobile devices only in Theme Settings to remove them

    .woodmart-show-categories {
    	display: none!important;
    }

    By the way, may we use your website in our theme showcase on ThemeForest? It looks very nice and clean so we would like to share it as an example for our potential customers.

    Kind Regards
    Xtemos

    #37148

    Antonio
    Participant

    It worked perfect.

    I am working very hard to create the best possible user experience using your tool.

    Of course you can use my website as an example of what can be done with your template.

    Thank you for your comment, I hope you continue to serve your users so well and that you continue creating content of such quality.

    A greeting from Spain

    #37159

    Antonio
    Participant

    Sorry but I rushed?

    I checked that the code worked well with the categories that do not have subcategories but also eliminates the function with which if they have them

    I send some screenshots to try to explain graphically

    Thank you very much for your support

    Attachments:
    You must be logged in to view attached files.
    #37190

    Artem Temos
    Keymaster

    Try to enable option called Show category neighbors if there is no children in Theme Settings -> Shop -> Sidebar & Page title.

    #37232

    Antonio
    Participant

    That does not work either, the idea is that the “drop down of categories” works the same in mobile version and desktop version. That when you reach a category, in this case “white gold alliances” that does not have a lower category, the drop-down disappears.

    I suppose it will have to be through some CSS code but not the one we tried before because that what it does is to completely eliminate the “categories dropdown”.

    Anyway, thank you very much for your help, if you find the solution please follow this thread.

    A greeting 😉

    #37311

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    function woodmart_product_categories_nav() {
    		global $wp_query, $post;
    
    		$show_subcategories = woodmart_get_opt( 'shop_categories_ancestors' );
    
    		$list_args = array(  
    			'taxonomy' => 'product_cat', 
    			'hide_empty' => false 
    		);
    
    		// Menu Order
    		$list_args['menu_order'] = false;
    		$list_args['menu_order'] = 'asc';
    
    		// Setup Current Category
    		$current_cat   = false;
    		$cat_ancestors = array();
    
    		if ( is_tax( 'product_cat' ) ) {
    
    			$current_cat   = $wp_query->queried_object;
    			$cat_ancestors = get_ancestors( $current_cat->term_id, 'product_cat' );
    
    		}
    
    		$list_args['depth']            = 5;
    		$list_args['child_of']         = 0;
    		$list_args['title_li']         = '';
    		$list_args['hierarchical']     = 1;
    		$list_args['show_count']       = woodmart_get_opt( 'shop_products_count' );
    		$list_args['walker'] = new WOODMART_Walker_Category();
    
    		$class = ( woodmart_get_opt( 'shop_products_count' ) ) ? 'has-product-count' : 'hasno-product-count';
    
    		$shop_link = get_post_type_archive_link( 'product' );
    
    		include_once( WC()->plugin_path() . '/includes/walkers/class-product-cat-list-walker.php' );
    		
    		if( !get_term_children( $current_cat->term_id, 'product_cat' ) ) return;
    		
    		echo '<div class="woodmart-show-categories"><a href="#">' . esc_html__('Categories', 'woodmart') . '</a></div>';
    
    		echo '<ul class="woodmart-product-categories ' . esc_attr( $class ). '">';
    		
    		echo '<li class="cat-link shop-all-link"><div class="category-nav-link"><a href="' . esc_url( $shop_link ) . '">
    				<span class="category-summary">
    					<span class="category-name">' . esc_html__('All', 'woodmart') . '</span>
    					<span class="category-products-count">
    						<span class="cat-count-label">' . esc_html__('products', 'woodmart') . '</span>
    					</span>
    				</span>
    		</a></div></li>';
    
    		if( $show_subcategories ) {
    			woodmart_show_category_ancestors();
    		} else {
    			wp_list_categories( $list_args );
    		}
    
    		echo '</ul>';
    	}
    #37607

    Antonio
    Participant

    Thank you very much for your help.

    In the end I decided to change the structure of the categories and leave the menu with the option that you show by default in the demo.

    Anyway I think that this could be applied in your next update since it can be considered a small failure of the template.

    A greeting.

    #37642

    Artem Temos
    Keymaster

    Great, yes, we will consider implementing it in our future updates.

Viewing 9 posts - 1 through 9 (of 9 total)