Tagged: custom menu, main-menu, menu
-
AuthorPosts
-
August 1, 2015 at 8:30 pm #481707
Good Evening,
My client wishes to separate their site into two different sections. I have created two menu’s which link to different pages.
As an example, one menu is called cars, one menu is called motorcycles. Each of these menu’s have their own links:
/cars/our-cars
/cars/our-cars/hatchbacks/motorcycles/our-motorcycles
/motorcycles/our-motorcycles/hondaFollowing advice from other threads on this forum, I have also created a child theme, and also copied over /includes/helper-main-menu.php.
I have copied in code below that I have added to /includes/helper-main-main.php within my child theme for the purposes of identifying the page ID, and outputting the relevant menu. I replaced
'menu_id' =>$avia_menu_class with 'menu_id' => '12',
however this does not retrieve either of the menu’s. Any help or advice would be greatly appreciated.<div class='container'> <?php /* * display the themes social media icons, defined in the wordpress backend * the avia_social_media_icons function is located in includes/helper-social-media-php */ $nav = ""; //display icons if(strpos( $headerS['header_social'], 'extra_header_active') !== false) echo $icons; if ( is_page( array(336, 208, 51, 376, 129) ) ) { echo "Cars Menu Required"; /* * display the main navigation menu * modify the output in your wordpress admin backend at appearance->menus */ // $extraOpen = $extraClose = $icon_beside = ""; // if($headerS['header_social'] == 'icon_active_main' && empty($headerS['bottom_menu'])){$icon_beside = " av_menu_icon_beside"; } // if($headerS['bottom_menu']){ $extraClose = "</div></div><div id='header_main_alternate' class='container_wrap'><div class='container'>"; } // echo $extraClose; // echo "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">"; // $avia_theme_location = 'avia'; // $avia_menu_class = $avia_theme_location . '-menu'; // $args = array( // 'theme_location' => $avia_theme_location, // 'menu_id' => '12', // 'menu_class' => 'menu av-main-nav', // 'container_class' => $avia_menu_class.' av-main-nav-wrap'.$icon_beside, // 'fallback_cb' => 'avia_fallback_menu', // 'walker' => new avia_responsive_mega_menu() // ); // wp_nav_menu($args); } elseif ( is_page( array(338, 372, 374, 376, 380) ) ) { echo "Motorcycles Menu Required"; /* * display the main navigation menu * modify the output in your wordpress admin backend at appearance->menus */ $extraOpen = $extraClose = $icon_beside = ""; if($headerS['header_social'] == 'icon_active_main' && empty($headerS['bottom_menu'])){$icon_beside = " av_menu_icon_beside"; } if($headerS['bottom_menu']){ $extraClose = "</div></div><div id='header_main_alternate' class='container_wrap'><div class='container'>"; } echo $extraClose; echo "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">"; $avia_theme_location = 'avia'; $avia_menu_class = $avia_theme_location . '-menu'; $args = array( 'theme_location' => $avia_theme_location, 'menu_id' => $avia_menu_class,h 'menu_class' => 'menu av-main-nav', 'container_class' => $avia_menu_class.' av-main-nav-wrap'.$icon_beside, 'fallback_cb' => 'avia_fallback_menu', 'walker' => new avia_responsive_mega_menu() ); wp_nav_menu($args); } else { echo "Whoops, no menu assigned!"; } //display navigation if(strpos( $headerS['header_secondary_menu'], 'extra_header_active') !== false ) { //display the small submenu //CSM commented out /* $avia_theme_location = 'avia2'; $avia_menu_class = $avia_theme_location . '-menu'; $args = array( 'theme_location'=>$avia_theme_location, 'menu_id' =>$avia_menu_class, 'container_class' =>$avia_menu_class, 'fallback_cb' => '', 'container'=>'', 'echo' =>false ); $nav = wp_nav_menu($args); */ }
August 3, 2015 at 11:53 am #482016Hey csmwebdesign!
Thank you for using Enfold.
You can combine the “cars” and “motorcycles” menu items into a single menu then use this plugin to control the visibility of the menu items: https://wordpress.org/plugins/menu-items-visibility-control/
Regards,
IsmaelAugust 4, 2015 at 9:40 pm #482997Hi Ismael, thanks for the reply. I have managed to achieve this using the plugin you have mentioned, although this feels like cheating somewhat? I would be really grateful if you could advise how to retrieve the menu based on the ID which I had started in the original post, I’m hoping it wasn’t too far off. Many thanks.
August 5, 2015 at 4:02 pm #483437Hey!
What do you mean by “cheating”? The plugin is specifically made for this kind of menu setup.
Regards,
IsmaelJanuary 7, 2016 at 3:35 pm #561289seems the plugin is not work on wordpress 4+?
January 7, 2016 at 3:43 pm #561301Hey!
Have you tried using this plugin – https://wordpress.org/plugins/zen-menu-logic/?
Cheers!
YigitJanuary 8, 2016 at 2:21 am #561740please refer to the website in private,
can our enfold make this kind of menu function (main menu)January 9, 2016 at 4:43 pm #562448Hi!
As I understand you need a one page scroll menu right? Yes our Enfold can make this please add a #ID on the page section you want to scroll to and the add the same ID in Appearence > menu > link
Best regards,
VinayJune 25, 2016 at 8:25 pm #653407Doen Zen Menu work with Enfold? I just tried it but I can’t get it to fly.
The location for the menu onöy seem to have one alterantive, and that is Avia?
/T
June 25, 2016 at 9:39 pm #653428Hey!
Thomas please do create a new ticket and explain us what you need to do, so we can be able to assist you.
Thanks a lot for your understandingRegards,
BasilisSeptember 20, 2019 at 6:41 pm #1140301Hello….my company just purchased Enfold. I am new to word press and creating my companies site and do not want to break anything in the coding. I have to say I am LOVING Enfold, for a first timer, it is so user friendly and the functionality is fabulous!!!!
I would love to know what the outcome of this menu issue was. I also would love to have a menu on the home page show certain options only and then on all other pages a different menu with added options.
Example – home page menu shown: Home – The One Call Process – Kids Corner – Resources – About Us
Then on all other pages have the menu show other options except for the page they are viewing – as example when they are on the Facility Owners page have the menu only show: Home – The One Call Process – Contractors – Homeowners – Kids Corner – Web Services – Resources – About Us
then when they are on Contractors page have the menu show: Home – The One Call Process – Facility Owners – Homeowners -Kids Corner – Web Services – Resources – About Us
I am not saying that the menu titles I listed are set in stone, those are just examples.
September 20, 2019 at 6:49 pm #1140307Hi,
@Oups4740 We are happy that you like Enfold! :)Please try using this plugin – https://eu.wordpress.org/plugins/zen-menu-logic/
If you have any other questions or issues, please start a thread under Enfold sub forum – https://kriesi.at/support/forum/enfold/#new-post :)
Best regards,
Yigit -
AuthorPosts
- The topic ‘Different menu on different pages’ is closed to new replies.