WordPress.org

Ready to get started?Download WordPress

Forums

Add a Title Attribute to Anchor Tags (3 posts)

  1. Patrick Rauland
    Member
    Posted 3 years ago #

    Hello,

    I am trying to print a menu using the standard wp_nav_menu function and I want to print the name of the menu item in the anchor tag as well as in the title attribute of the anchor tag.

    So right now I have this:

    <ul>
      <li><a href="#">example</a>
    </ul>

    And I want this:

    <ul>
      <li><a href="#" title="example">example</a>
    </ul>

    Any suggestions on how to do this? I don't see any solutions in the docs.

  2. Curtiss Grymala
    Member
    Posted 3 years ago #

    When you add an item to the menu in the "Menus" administration area, you have the option to set a title attribute for each one.

  3. Patrick Rauland
    Member
    Posted 3 years ago #

    *facepalm*

    Thanks for the help, sometimes it feels like I take one step forward and two steps back. :)

Topic Closed

This topic has been closed to new replies.

About this Topic