WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using

        'theme_location' => 'header-menu',
        'menu_class' => 'nav-bar',
        'container' => 'nav'

to output my navigation menu list. Currently they automatically get classes added to them like page-item-8, page-item-6. I work on a local machine and upload to my server. My problem is the page-item numbers are different and I can't select them properly. What I want to do is add a class home, shop, services, etc to the respective list item.

Is there a better way to do this.

Thanks in advance.

share|improve this question

The simple way would to add the css class to the individual titles in the wp-admin/menus section.

First, go to the screen options and select the css checkbox:

enter image description here

Next, open the menu item and give it a class. In my example it would have the class .home-page:

enter image description here

share|improve this answer

Ok I just added to my functions.php file went to appearance menus, changed screen options to allow classes. Then Added a individual class for each one. Awesome!

function register_my_menus() {
    array('header-menu' => __( 'Header Menu' ) )
add_action( 'init', 'register_my_menus' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.