Creating New Menu In BW WordPress Theme

To create an additional menu in the BW WordPress theme we first open the functions.php file. This file is located in Admin => apprearance => Editor.

Then we insert a few lines of code to registers the menu like this:

function register_nav_menu() {
register_nav_menu('my-new-menu', __ ('New Menu', 'black-white'));
add_action('init', 'register_new_menu');

In the Manage Locations on Menus page now has new location called New Menu and ready to use.

costum menu BW WordPress Theme

To display this new menu we put some lines of code as below. For example, if we put in footer.php file after the line </ div> <! – # Main ->.

<? php wp_nav_menu(array ('theme_location' => 'my-new-menu'));?>

Now we’ve seen the apparition’s New Menu but there is still no style, so we created a style for the menu. Examples like this.

.my-menu {
clear: both;
display: block;
background: #fff;
padding: 10px 20px;
border: 5px solid #666;
margin-bottom: 10px;
.my-menu ul {
list-style: none;
margin: 0;
padding-left: 0;
.my-menu li {
display: inline;
.my-menu li a {
text-decoration: none;
color: #000;
margin: 2px 10px;
padding: 5px;
.my-menu li a: hover {
color: #fff;
background: #000;

And finally completed and on file before we add a line footer.php div for the menu style.

<div class="my-menu">
<? php wp_nav_menu(array ('theme_location' => 'my-new-menu'));?>
</ div>

Finally it looks like this.
custom-menu BW WordPress Theme


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s