[wp-hackers] wp_nav_menu?

Chip Bennett chip at chipbennett.net
Mon Apr 4 16:10:25 UTC 2011


By "Control Panel", do you mean Dashboard -> Appearance -> Menus?

If so, then ensure that you have enabled display of custom classes for menu
items:

1) Click the "Screen Options" tab in the upper right-hand corner
2) Enable the check-box for "CSS Classes"
3) Edit each menu item as needed, by adding custom classes to the "CSS
Classes (optional)" text field

(And if this is too simplistic, or not what you're looking for; my
apologies.)

Chip

On Mon, Apr 4, 2011 at 11:00 AM, Thomas Belknap
<dragonfly at dragonflyeye.net>wrote:

> Am I wrong in thinking that the only way to modify the output of menus is
> to
> use the above hook? If I wanted to add a class to each menu item, I would
> have to use a regular expression to pull each one out? Most everything I
> see
> suggests some variation of the following:
>
> function add_markup_pages($output) {
>    $output= preg_replace('/menu-item/', 'first-menu-item menu-item',
> $output, 1);
> $output=substr_replace($output, "last-menu-item menu-item",
> strripos($output, "menu-item"), strlen("menu-item"));
>    return $output;
> }
> add_filter('wp_nav_menu', 'add_markup_pages');
>
> The above code is not quite what I need, of course. But I find it strange
> that we can't just apply classes in the Control Panel for menus?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list