• function nav_list_portfolio_bugfix($classes, $item)
    {
    	if (get_post_type() == 'portfolio')
    	{
    		// Change value to match the slug for your portfolio wordpress page
    		$page = get_page_by_path('portfolio');
    
    		if ($page)
    		{
    			if ($page->ID != $item->object_id)
    			{
    				foreach ($classes as $key => $value)
    				{
    					if ($value == 'current_page_parent')
    					{
    						unset($classes[$key]);
    						break;
    					}
    				}
    			}
    			else
    			{
    				array_push($classes, 'current_page_parent');
    			}
    		}
    	}
    
    	return $classes;
    }
    
    add_filter('nav_menu_css_class',  'nav_list_portfolio_bugfix', 10, 2);

    https://www.ads-software.com/extend/plugins/simple-portfolio/

Viewing 1 replies (of 1 total)
  • Thread Starter Steven Vachon

    (@prometh)

    Update. Change this:

    array_push($classes, 'current_page_parent');

    to this:

    // 'current-menu-item' added for compatibility with other plugins
    array_push($classes, 'current_page_parent', 'current-menu-item');

    If it creates a problem with your code, just use the original line.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Simple Portfolio] Fix for wp_nav_menu current css class’ is closed to new replies.