• Hi,

    I have the following code

    <?php
    function menu_element_class($classes, $item){
        if($item->ID == 21 || $item->menu_item_parent == 21) {
            $classes[] = "menu_element";
        }
        return $classes;
    }
    
    add_filter('nav_menu_css_class' , 'menu_element_class' , 10 , 2);
    ?>

    I found this running through some previous questions around this area. However this adds the class to the list item and not the “element” beneath it.

    The real reason i want it is i would like to have some of my main navigation items pop up in a thickbox, i have the thickbox plug in and it works, i just need the class=”thickbox” assigned to it.

Viewing 1 replies (of 1 total)
  • Thread Starter Bmathers

    (@bmathers)

    Id like to add that obviously im no PHP programmer, i can just about read/understand whats going on.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Class on anchors in menu li items’ is closed to new replies.