How Do I Change the Navigation Bar in WordPress Mobile?
When you first install WordPress on your mobile device, you’re likely given a default set of navigation buttons that take you between the different sections of your site. However, if you want to customize your site’s navigation, you can do so by editing the WordPress Mobile Theme’s nav-bar.
php file.
To edit nav-bar.php, open it in your text editor of choice and locate the following lines of code:
‘header’, ‘container’ => ‘header-area’, ‘menu_class’ => ‘main-menu’, ‘container_class’ => ‘row’, ‘menu_item_type’ => ‘post’, ‘menu_item_id’ => ‘2’, ‘menu_order’ => ‘1’, ‘menu_position’ => ‘1’, ‘has_submenu’ => ‘0’, ‘level’ => ‘1’, ‘submenu_type’ => ‘0’, ‘item_count’ => ‘3’, ‘item_type’ => ‘nav_menu_item’, ‘nav_menu_id’ => ‘3’, ‘menu_item_name’ => ‘Blog Posts’, ‘menu_item_description’ => ‘A list of your blog posts.’, ‘separator’ => ”, ‘menu_link’ => ‘/’, ‘home’ => ‘1’, ‘front-page’ => ‘0’, ‘archive’ => ‘2’, ‘search’ => ‘3’, ‘active’ => ‘1’, ‘disabled’ => ‘0’, ‘categories’ => ‘4’, ‘tag_cloud’ => ‘5’, ‘meta_box’ => ‘6’, ‘footer-widgets’ => ‘7’, ‘custom_links’ => ‘8’ ) ); ?>
You’ll notice that the theme_location parameter is set to header . This tells WordPress Mobile to use the nav_bar.
php file located in the theme’s header directory, which is where most WordPress themes place their nav_bar.php file.
The next line of code you’ll need to edit is menu_class . This parameter tells WordPress Mobile which class to use to display the menu items on the nav bar.
In this example, we’re using the main-menu class to display the blog posts menu items.
Next, find the menu_item_type line and change it to post . This tells WordPress Mobile to use the post type as the default menu item type.
The last line of code you need to change is menu_item_id . This line tells WordPress Mobile which menu item to display.
In our example, we’re using the post menu item ID of 2 .
Now, locate the separator line and add a space between the menu_link and the home menu item.
Next, locate the front-page line and remove the space between the menu_link and the front-page menu item.
Finally, locate the archive line and add a space between the menu_link and the archive menu item.
Now, locate the search line and add a space between the menu_link and the search menu item.
Lastly, locate the active line and add a space between the menu_link and the active menu item.
Next, locate the disabled line and add a space between the menu_link and the disabled menu item.
Next, locate the categories line and add a space between the menu_link and the categories menu item.
Next, locate the tag_cloud line and add a space between the menu_link and the tag_cloud menu item.
Next, locate the meta_box line and add a space between the menu_link and the meta_box menu item.
Finally, locate the footer-widgets line and add a space between the menu_link and the footer-widgets menu item.
Now, you’ll need to add some menu items to the nav_bar.
To do this, open up a new file called posts.php and add the following lines of code:.
‘header’, ‘container’ => ‘header-area’, ‘menu_class’ => ‘main-menu’, ‘container_class’ => ‘row’, ‘menu_item_type’ => ‘post’, ‘menu_item_id’ => ‘2’, ‘menu_order’ => ‘1’, ‘menu_position’ => ‘1’, ‘has_submenu’ => ‘0’, ‘level’ => ‘1’, ‘submenu_type’ => ‘0’, ‘item_count’ => ‘3’, ‘item_type’ => ‘nav_menu_item’, ‘nav_.