Create a custom menu location for WordPress


Since WordPress 3.0, there has never been easier to and edit menus . This feature is nevertheless complicated to use if your theme does not support the location of menus.

 

In this tutorial, we will see how to define a site of navigation menu.

In other words, it will be possible to indicate directly from the module and Appearance menu, where it will be displayed by selecting one of the sites we have specified.

 

 

Step 1 – the file functions.

 

Note: Be careful not to duplicate this feature if your theme supports this functionality natively. Therefore made a preliminary search using the Find command of your browser.

 

As often, we need to edit the functions.php file in the / wp-content/themes/Your_Theme_name/functions.php accessible via an FTP client.

You can also go through the module and then Appearance Editor to Menu.

End of file, add the following lines of code:

 

 

<? Php
add_action (‘init’, ‘register_my_menus’);
register_my_menus function () {
register_nav_menus (
array (‘top-navigation’ => __ (‘Top’), ‘footer-menu’ => __ (‘Footer’))
);
}
?>

 

This snippet will create the of two locations for your theme and menu to initialize the function menu creations.


 

 

Step 2 – Changing Your WordPress Theme

 

Obviously, this technique presumes to have inserted into your theme, the function that will display the menu in question.

 

<? Wp_nav_menu php (array (‘theme_location’ => ‘Top’));?>

 

This command will then display the Top Menu you can create / modify from the WordPress admin. A generally into the header.php file.

 

Step 3 – Select the location of menus

 

Then return to Appearance then Menus. Note the appearance of a new box containing the parameters under locations. A drop down list you can then select the menu display:

 

 

Create a custom menu location for WordPress

 

You are now able to define the locations of navigation menus in your WordPress theme. Convenient, right?

Signature


0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave Lame Behind - Get Engaged

Here’s what we’ve got for you:

Contact Us Today for Smarter Marketing of Knowledge

See each of the premium resources below:

For Publishers and Content Owners

Do you want to optimize your available content?

Do you want to increase the visibility of your content?

Do you want to increase your reliability as an Author?

Do you want your next or existing project to be technically planned?

If your answer to any of these is YES contact us with your approximate budget.

Contact Us Today

For the Media Companies and Advertisers

You must be seeking a publisher website like ours with real content to give an exposure to your client's business?

We provide Industry's Standard opportunities for advertisement.

Do you want some promotion that comes with proper invoicing, SLA on per annum basis?

If your answer is YES contact us today for a quote.

Contact Us Today for Quote

Mentions

  1. Hvordan-endre-rekkef-lgen-p-sider says:

    [...] Hvis themet ditt ikke har menyplassering der hvor du ønsker å vise sidene må du først legge til dette i filen. [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>