Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1212709

    Hi, i’m struggling with the title matter: i’m building an ecommerce, and on my category pages i need to see a sub menu or a fullwidht secondary menu. I made a custom shop page (still incomplete) and you can see how I set the full width secondary menu. I just need a way to add that same menu on all the category archive pages.

    Could you please help me?

    #1213191

    Hi, anybody can help with this?

    #1213847

    Hi,
    Sorry for the late reply, you can add the sub-menu to pages as a function with a shortcode, for example, this function will add a sub-menu to your archive pages.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    add_action('ava_after_main_title', 'ava_after_main_title_mod');
    function ava_after_main_title_mod() {
    	if(is_archive()) {
    		echo do_shortcode("[av_submenu which_menu='center' menu='25' position='center' color='main_color' sticky='true' mobile='disabled' mobile_submenu=''][av_submenu_item title='Menu Item 1'][av_submenu_item title='Menu Item 2'] [av_submenu_item title='Menu Item 3']
    [/av_submenu]");
    	}
    }

    note the shortcode after the line echo do_shortcode(" that is were to add your shortcode, to get this shortcode Enable the Avia Layout Builder Debugger and copy the shortcode from the debugger
    2020-05-17_125025.png

    Best regards,
    Mike

    #1214008

    Hi Mike, thanks for your help.
    I did everything you said and it worked. The problem now is that secondary menu is appearing on blog archive pages.
    I need it instead on woocommerce product category pages.
    How can I modify the code in order to obtain this?

    Thanks

    #1214021

    Hi,
    Thank you for the feedback, try changing is_archive() to is_product_category() in the code.

    Best regards,
    Mike

    #1214050

    Hi mike, unfortunately it didn’t work. It made the submenu disappear from blog category page, but it didn’t show on product category page. I made the change on the function.php file. Should we add the code to some woocommerce php files?

    #1214592

    Hi Mike (or any other moderator), i’m sorry to insist but we really really need to fix this as soon as possible.
    We submitted or request seven days ago already. I’m aware you all answer a ton of question everyday, but in many years working with enfold and your support, it never happened to keep waiting for so long to get help.
    So, please, could anybody answer since there is not other way to contact support besides this?

    #1214667

    Hi,
    Sorry for the late reply, I have tested several woocommerce hooks to add the sub-menu shortcode which works for the product archive pages but it brakes the layout, so I’m looking into why this is and if there is another way to do this. I appreciate your patience, thank you.

    Best regards,
    Mike

    #1214683

    Ok thanks Mike, i’ll be waiting for your advice.
    It could also work a normal secondary menu and not only a full width sub menu

    #1215215

    Hi,
    I was able to target the archive product page with this function:

    add_action('ava_after_main_container', 'custom_submenu');
    function custom_submenu() {
    	$classes = get_body_class();
    if ((in_array('woocommerce-page',$classes)) || (in_array('archive',$classes))) {
    		echo do_shortcode("[shortcode]");
    } else {
        }
    
    }

    but the full-width sub-menu still brakes the sidebar layout, is it important to you to use the sidebar on those pages?

    Best regards,
    Mike

    #1215261

    Mike, i added the code, but I only see a text saying [shortcode]
    I many not use the sidebar eventually.

    #1215589

    Hi,
    Sorry I didn’t mean for you to use that code I was just trying to show the part of the code that checks the page for the two classes which means it’s a woocommerce archive page.
    So I copied the HTML code for your sub-menu and added it via javascript, which works without braking the page or sidebar layout.
    Please clear your browser cache and check.

    Best regards,
    Mike

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Show a full width secondary menu (or a sub menu) on archive category pages’ is closed to new replies.