-
AuthorPosts
-
May 13, 2020 at 6:59 pm #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?
May 15, 2020 at 9:15 am #1213191Hi, anybody can help with this?
May 17, 2020 at 6:51 pm #1213847Hi,
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
Best regards,
MikeMay 18, 2020 at 12:57 pm #1214008Hi 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
May 18, 2020 at 1:15 pm #1214021Hi,
Thank you for the feedback, try changingis_archive()
tois_product_category()
in the code.Best regards,
MikeMay 18, 2020 at 3:26 pm #1214050Hi 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?
May 20, 2020 at 9:35 am #1214592Hi 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?May 20, 2020 at 2:20 pm #1214667Hi,
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,
MikeMay 20, 2020 at 3:02 pm #1214683Ok thanks Mike, i’ll be waiting for your advice.
It could also work a normal secondary menu and not only a full width sub menuMay 22, 2020 at 1:02 pm #1215215Hi,
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,
MikeMay 22, 2020 at 3:52 pm #1215261Mike, i added the code, but I only see a text saying [shortcode]
I many not use the sidebar eventually.May 23, 2020 at 9:52 pm #1215589Hi,
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 -
AuthorPosts
- The topic ‘Show a full width secondary menu (or a sub menu) on archive category pages’ is closed to new replies.