Tagged: full-width submenu, menu, woocommerce
-
AuthorPosts
-
July 2, 2015 at 3:32 pm #467581
Hi,
I have hunted around for the answer to this, and I’m surprised I seem to be the only one who wants it?
Basically, I want to have a full width sub menu on most of the pages on my site. I could add it via the advanced layout builder, but I want to add it to a “WooCommerce Shop Overview” page (which blocks the layout builder) and also add it to some product category “pages” (which of course don’t have a wysiwyg at all!)
I need help solving this please. I tried creating it on a page, and grabbing the shortcode using the debug option, but it broke so many things when adding it to the category description
I was thinking, is there a way of adding the fullwidth submenu location as a new menu location? I can then worry about hiding it on the few pages I don’t want it on.
Thanks in advance!
- This topic was modified 9 years, 5 months ago by mikebackhouse.
July 6, 2015 at 11:01 am #468793Hi mikebackhouse!
we need a link to your website, showing us what’s going on for you. Admin access would be helpful to us as well. Make sure to use newest theme version. Post login details here as private reply.
Best regards,
AndyJuly 6, 2015 at 11:10 am #468801Brilliant! Thanks Andy.. details below
(Could you let me know what you did after? As I would like to do similar on another site I have)July 7, 2015 at 11:43 am #469557Hi!
login details are not working for me. Please check.
Regards,
AndyJuly 7, 2015 at 2:04 pm #469652Sorry andy, I knew I would do something wrong! please try again
July 8, 2015 at 6:27 pm #470453Hey!
you can try to use shortcodes instead. Activate debug mode and use the shortcodes you generate when using ALB to put them inside of WooCommerce shop page.
Best regards,
AndyJuly 9, 2015 at 1:44 pm #470824Sorry Andy, I already tried that, that’s what I mean by
I tried creating it on a page, and grabbing the shortcode using the debug option, but it broke so many things when adding it to the category description
:)
Sorry, I must have not made sense. But yeah, unfortunately that didn’t work I’m afraid. Would it be possible in some way to set the submenu as a “menu location”? Then add pages etc.. to that via the wp menu options?
July 9, 2015 at 1:58 pm #470847Hey!
not sure what you mean by your last question. Why do shortcodes not work for you? what exactly is breaking for you? can you show us what’s going on? please use screenshots and provide us a precise link where we can see the issue.
Cheers!
AndyJuly 9, 2015 at 2:29 pm #470881Thanks Andy, when adding the following shortcode (just as an example):
[av_submenu which_menu='custom' menu='41' position='center' color='main_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 3' link='manually,http://' linktarget='' button_style=''] [/av_submenu]
..to the “products” page (named “documents” on my site) the sidebar shifts to below the main content and the body gets cut short.
Screenshots:
No shortcode: http://snag.gy/QNmbN.jpg
With shortcode: http://snag.gy/V5bXN.jpgAnd basically the same thing happens when I add the shortcode to woocommerce product category description: http://snag.gy/iH8UL.jpg
- This reply was modified 9 years, 5 months ago by mikebackhouse.
July 10, 2015 at 10:48 am #471378Hi!
Please try this in the functions.php file:
add_action('ava_after_main_title', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { echo do_shortcode("[av_submenu which_menu='custom' menu='41' position='center' color='main_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 3' link='manually,http://' linktarget='' button_style=''] [/av_submenu]"); }
Check one of the page or post.
Regards,
IsmaelJuly 10, 2015 at 10:56 am #471382Love it! That works perfectly, thanks Ismael
Now, how do I get it to show on the woocommerce shop page and category description?
July 13, 2015 at 7:23 am #472146Hey!
You can try this:
add_action('avia_breadcrumbs_trail', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { echo do_shortcode("[av_submenu which_menu='custom' menu='41' position='center' color='main_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 3' link='manually,http://' linktarget='' button_style=''] [/av_submenu]"); }
Regards,
IsmaelJuly 13, 2015 at 10:12 am #472211Sorry, that’s not quite worked. This is a bit beyond me, I had to make one change to the following:
add_action('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod'); function avia_breadcrumbs_trail_mod() { echo do_shortcode("[av_submenu which_menu='custom' menu='51' position='center' color='socket_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [/av_submenu]"); }
But I’m now getting the following errors:
Warning: array_pop() expects parameter 1 to be array, null given in /home/ACCOUNT/public_html/SITE/wp-content/themes/enfold/config-woocommerce/config.php on line 437
Warning: array_merge(): Argument #1 is not an array in /home/ACCOUNT/public_html/SITE/wp-content/themes/enfold/config-woocommerce/config.php on line 444
(although the menu IS showing at least!)
- This reply was modified 9 years, 5 months ago by mikebackhouse.
July 14, 2015 at 10:05 am #472936July 14, 2015 at 10:14 am #472949Thanks Josue, that fixed it.
Although I didn’t realise, my previous example has knocked the left sidebar down below the main content.
add_action('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod'); function avia_breadcrumbs_trail_mod() { echo do_shortcode("[av_submenu which_menu='custom' menu='51' position='center' color='socket_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [/av_submenu]"); }
And using Ismael’s example just breaks the whole site unfortunately.
add_action('avia_breadcrumbs_trail', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { echo do_shortcode("[av_submenu which_menu='custom' menu='41' position='center' color='main_color' sticky='aviaTBsticky' mobile='disabled'] [av_submenu_item title='Menu Item 1' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 2' link='' linktarget='no' button_style=''] [av_submenu_item title='Menu Item 3' link='manually,http://' linktarget='' button_style=''] [/av_submenu]"); }
What am I doing wrong?
- This reply was modified 9 years, 5 months ago by mikebackhouse.
July 14, 2015 at 12:23 pm #473074The problem with using shortcode directly is that it will try to create a fullwidth element, hence the sidebar issue. Try with the following instead:
add_filter('avia_breadcrumbs', function() { ob_start(); ?> <div class="container av-menu-mobile-disabled "> <ul id="av-custom-submenu-1'" class="av-subnav-menu av-submenu-pos-center"> <li class="menu-item menu-item-top-level menu-item-top-level-1"><a href=""><span class="avia-bullet"></span><span class="avia-menu-text">Menu Item 1</span></a></li> <li class="menu-item menu-item-top-level menu-item-top-level-2"><a href=""><span class="avia-bullet"></span><span class="avia-menu-text">Menu Item 2</span></a></li> </ul> </div> <?php return ob_get_clean(); });
Regards,
JosueJuly 14, 2015 at 12:28 pm #473084Perfect! Thank you Josue.
Although Is there no way of setting a new menu location? I notice these are manual links, is there some way of setting a menu I’ve created in the admin?
- This reply was modified 9 years, 5 months ago by mikebackhouse.
July 14, 2015 at 1:18 pm #473122Hi!
In that case you can use wp_nav_menu:
add_filter('avia_breadcrumbs', function() { ob_start(); wp_nav_menu( array('menu' => 'Project Nav', 'menu_class' => 'av-subnav-menu')); return ob_get_clean(); });
Change “menu” parameter.
Cheers!
JosueJuly 14, 2015 at 1:43 pm #473149So close!! I’m really sorry to keep asking, it DOES work (I’ve tweaked it slightly) :
add_filter('avia_breadcrumbs', function() { ob_start(); wp_nav_menu( array('menu' => 'test submenu', 'menu_class' => 'av-subnav-menu av-submenu-pos-center')); return ob_get_clean(); });
But can I set the class as “socket color” I’ve tried but it didn’t look right (the links were still light)
Also, it can’t deal with a drop down, the menu disappears behind the main body of the page.
Also (and this is a cheeky request!) can we get it to appear above the breadcrumbs? It was in that position when I was using:
add_action('ava_after_main_container', 'ava_after_main_title_mod');
Thank you, I know I’m asking a lot but I would really appreciate this. Odds are, I’ll be using it on all my other sites too
July 15, 2015 at 11:40 am #473627Hi!
Replace the code with this:
add_filter('avf_title_args', 'avf_title_args_mod', 10, 2); // edit default title function avf_title_args_mod($args,$id) { ob_start(); echo '<div id="sub_menu1" class="av-submenu-container main_color container_wrap sidebar_right" style="z-index: 301; top: auto; position: absolute;"><div class="container av-menu-mobile-disabled">'; wp_nav_menu( array('menu' => 'test submenu', 'menu_class' => 'av-subnav-menu av-submenu-pos-center')); echo '</div></div>'; $menu = ob_get_clean(); $args['html'] = "{$menu}<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}></div></div>"; return $args; }
Regards,
IsmaelJuly 15, 2015 at 12:59 pm #473687Absolutely perfect!! Thanks so much Ismael. Please mark this as resolved :)
July 15, 2015 at 2:05 pm #473739Hey!
glad Ismael could help you! Let us know in a new ticket if you have some more questions or issues related to the theme. We are happy to assist you.
Cheers!
Andy -
AuthorPosts
- The topic ‘Full width submenu as new menu location’ is closed to new replies.