WordPress.org

Ready to get started?Download WordPress

Forums

How can I give id values to my navbar links? (4 posts)

  1. ArtInMotion
    Member
    Posted 6 years ago #

    Hello,

    I'm trying to create a graphical navbar on my site, similar to those at blazersix.com and ndesign-studio.com. At those sites, the li elements have classes like "#nav-about" and "#nav-home." On standard WordPress sites, these classes do not show up.

    For instance, here's what the code for a navigation link looks like on ndesign-studio:

    <li id="nav-home"><a href="http://www.ndesign-studio.com/">Blog</a></li>

    ...and here's what the code for a nav link looks like on my page:

    <li class="page_item page-item-3 current_page_item "><a href="http://www.lightningux.com" title="Home">Home</a></li>

    So on my page, there is no ID that clearly identifies each navigation item. Does anyone know how I can make my WP installation output links like the former one, where each navigation link has an ID that can easily be referenced from CSS? Thanks.

  2. Michael Fields
    Themer
    Posted 6 years ago #

    Hi.
    Your html is actually already set up to do this. Check out the class attribute:

    class="page_item page-item-3 current_page_item "

    The important part is: page-item-3. You can apply a style to each item in you navigation by using this.

    you could also hard-code your navigation with exactly the html you want.

  3. odilonLPV
    Member
    Posted 6 years ago #

    I have exactly the same problem and it appears on each li. I'm also using Subpage Listing plugin and it appears here too, that makes impossible to apply a style on them.
    I guess it's a WP little configuration trick but what one?

  4. tjobbe
    Member
    Posted 6 years ago #

    Would this help? Maybe not what you are looking for, but worth pointing you to it anyway.

    http://www.farstyle.com/web-design-development/showing-active-page-in-wordpress/

Topic Closed

This topic has been closed to new replies.

About this Topic