Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#16763 closed enhancement (worksforme)

nav-menu-template.php Does Not Add $class_names to Anchor Tags, Preventing Custom Theming

Reported by: obiwanmikenolte's profile obiwanmikenolte Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1
Component: Menus Keywords:
Focuses: Cc:

Description

The $item_output portion of wp-includes/nav-menu-template.php that defines what the a tag will contain doesn't include a class attribute, whereas the ul tag does. This prevents customized theming (e.g. colors, images before/after, etc.) of the menu links. This can be modified by appending $class_names to $item_output's <a line, i.e.

$item_output .= '<a'. $attributes .'>';

becomes

$item_output .= '<a'. $attributes . $class_names .'>';

Change History (3)

#1 @obiwanmikenolte
14 years ago

  • Cc obiwanmikenolte added

#2 @andymacb
14 years ago

But the wrapping <li> is full of class names and also has a filter for adding your own, so your anchors can be targetted with li.the-class-you-want a {}

A.

#3 @SergeyBiryukov
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

As andymacb pointed out, you can customize menu links using <li> tags' class names.

Note: See TracTickets for help on using tickets.