thewirelessguy / cornerstone

Cornerstone is a WordPress starter theme based on the Zurb Foundation Responsive Framework. Cornerstone aims to provide a lightweight starter theme that is responsive and SEO friendly that web designers can build great looking websites on.
GNU General Public License v2.0
155 stars 40 forks source link

Single page nav anchor links do not get active class #29

Closed ghost closed 7 years ago

ghost commented 8 years ago

Have had success with other themes implementing the following in functions.php, but it does not seem to work in Cornerstone:

add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);

function special_nav_class ($classes, $item) {
    if (in_array('current-menu-item', $classes) ){
        $classes[] = 'active ';
    }
    return $classes;
}
alana-mullen commented 8 years ago

There's already a filter on nav_menu_css_class in inc/foundation.php. To replace the function in your child theme rename your function cornerstone_active_nav_class and this will override the existing function in Cornerstone.