Forum Replies Created

Viewing 2 replies - 46 through 47 (of 47 total)
  • Thread Starter Tim Gieseking

    (@timstl)

    Another problem?

    Plugin is inserting into head:

    <link rel='stylesheet' id='simplemap-map-style-css' href='http://###domainremoved####/wp-content/plugins/simplemap/simplemap-styles/mytheme.css?ver=3.0.3' type='text/css' media='all' />

    This is the wrong path, as the themes are located in plugins/simplemap-styles. If I move simplemap-styles into the simplemap folder, they are no longer available in the admin area, so I can’t activate my theme.

    Forum: Plugins
    In reply to: Custom Post Type Parent

    Here is the solution I am using for this problem. This is somewhat of a hack, but it’s getting the job done. You would place this code in your functions.php.

    function remove_parent($var)
    {
    	// check for current page values, return false if they exist.
    	if ($var == 'current_page_parent' || $var == 'current-menu-item' || $var == 'current-page-ancestor') { return false; }
    
    	return true;
    }
    
    function tg_add_class_to_menu($classes)
    {
    	// team is my custom post type
    	if (is_singular('team'))
    	{
    		// we're viewing a custom post type, so remove the 'current-page' from all menu items.
    		$classes = array_filter($classes, "remove_parent");
    
    		// add the current page class to a specific menu item.
    		if (in_array('menu-item-239', $classes)) $classes[] = 'current-page-ancestor';
    	}
    
    	return $classes;
    }
    
    if (!is_admin()) { add_filter('nav_menu_css_class', 'tg_add_class_to_menu'); }

    One downside: I’m using an ID to decide which menu item to add the current class to, so if you delete/readd a page you have to edit this code.

Viewing 2 replies - 46 through 47 (of 47 total)