Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WP Menu Simple Code
- Past This Code functions.php File.....
- this is code for one menu
- register_nav_menu('id name','Show Name');
- register_nav_menus(array(
- 'mainmenu' => __('Main Menu','basic'),
- 'footermenu' => __('Footer Menu','basic')
- ));
- this is code past menu location...
- wp_nav_menu(array(
- 'theme_location' => 'mainmenu',
- ));
- advance Menu System.....
- This Is Code Past functions.php
- function theme_menu(){
- if(function_exists('register_nav_menu')){
- register_nav_menu('mainmenu','Andia Menu');
- };
- };
- add_action('init','theme_menu');
- // fall back function
- function menu_fallback_cb(){
- echo '<ul class="nav navbar-nav navbar-right">';
- if(is_user_logged_in()){
- echo '<li class="active"><a class="page-scroll" href="'.home_url().'/wp-admin/nav-menus.php">Create Menu</a></li>';
- }
- else{
- echo'<li class="active"><a class="page-scroll" href="'.home_url().'">Home</a></li>';
- }
- echo '</ul>';
- }
- #### This is code past Menu Location.....
- if(function_exists('wp_nav_menu')){
- wp_nav_menu(array(
- 'theme_location'=>'mainmenu',
- 'menu_class' => 'nav navbar-nav',
- 'fallback_cb' => 'fallback_menu',
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement