Title: Menu problem CSS choosing wrong current_page_parent
Last modified: August 19, 2016

---

# Menu problem CSS choosing wrong current_page_parent

 *  [TomCraig](https://wordpress.org/support/users/tomcraig/)
 * (@tomcraig)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/)
 * I’m using custom post types, but when selecting a custom post entry, my menu 
   bar thinks I’m back in the “news” area of the site.
 * For example, when I’m on the landing page for the area in question, I get: [http://www.evoenergy.co.uk/case-studies/](http://www.evoenergy.co.uk/case-studies/)(
   with case studies selected as current page).
 * However, when I dig a bit deeper into the area, going to [http://www.evoenergy.co.uk/system-type/on-roof/](http://www.evoenergy.co.uk/system-type/on-roof/)
   for example, it highlights news, making me think I’m in the news area.
 * I’m pretty sure this is CSS related: when I’m in the “case study” area, the css
   says this for the news menu item: menu-item menu-item-type-post_type current_page_parent
   menu-item-2883
 * Any help MUCH appreciated!

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Linosa](https://wordpress.org/support/users/linosa/)
 * (@linosa)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895236)
 * No, I don’t think this is a css problem. You’ve written your css correct. The
   problem is that wordpress spots out wrong class as the current.
 * Are this pages or categories?
 *  [Linosa](https://wordpress.org/support/users/linosa/)
 * (@linosa)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895237)
 * The problem is when you go to a single post, am I right?
    You’ve probably choosed
   news as the single-post-page.
 *  Thread Starter [TomCraig](https://wordpress.org/support/users/tomcraig/)
 * (@tomcraig)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895238)
 * Linosa
 * Thanks for the fast response!
 * It happens when I go to a category page: [http://www.evoenergy.co.uk/system-type/on-roof/](http://www.evoenergy.co.uk/system-type/on-roof/)
 * Or a single post page:
    [http://www.evoenergy.co.uk/solar-pv-case-studies/20-x-solar-century-185-panels-in-gwent/](http://www.evoenergy.co.uk/solar-pv-case-studies/20-x-solar-century-185-panels-in-gwent/)
 * The problem is I also have a news area, which needs to be set as news for single
   posts.
 * Is there a way to tell wordpress that these custom posts are “special” and should
   be treated differently to standard news posts?
 * Many Thanks
 * Tom
 *  [Linosa](https://wordpress.org/support/users/linosa/)
 * (@linosa)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895246)
 * Yeah, I have the same problem myself. WordPress dosen’t understand by defaut 
   which page it’s suppose to be.
 * I solved it by putting a class around my different single-pages and then used
   it for marking the menu. Like:
    .interviews #menu ul li.menu-item-642 {background:#
   4e4e4e;}
 * Guess there’s better way of doing it though. I just could’t come up with anything
   else.
 *  Thread Starter [TomCraig](https://wordpress.org/support/users/tomcraig/)
 * (@tomcraig)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895247)
 * is that along the lines of:
 *     ```
       // Add current-menu-item functionality to custom post types
       add_filter( 'hybrid_body_class', 'add_to_body_class' );
   
       function add_to_body_class( $class ) {
   
           global $post;
   
        	// Use switch to filter through custom post types
       	switch(get_post_type())
        	{
        		case 'Films':
       		// If custom post type is films, add current-menu-item class to body.
        		$classes[] = 'current-menu-item';
   
        		break;
   
        	}
        	// return the $classes array
        	return $classes;
       }
       ```
   
 * it’s pretty annoying that it doesn’t see a custom post correctly…
 *  [Linosa](https://wordpress.org/support/users/linosa/)
 * (@linosa)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895251)
 * Where did you find that?
 *  Thread Starter [TomCraig](https://wordpress.org/support/users/tomcraig/)
 * (@tomcraig)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895252)
 * [http://themehybrid.com/support/topic/how-to-add-current-menu-item-class-for-custom-post-type](http://themehybrid.com/support/topic/how-to-add-current-menu-item-class-for-custom-post-type)
 *  [Linosa](https://wordpress.org/support/users/linosa/)
 * (@linosa)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895257)
 * Ok, that script is suppose to give the body tag an class.. am I right or wrong?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Menu problem CSS choosing wrong current_page_parent’ is closed to new
replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [menu](https://wordpress.org/support/topic-tag/menu/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Linosa](https://wordpress.org/support/users/linosa/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/menu-problem-css-choosing-wrong-current_page_parent/#post-1895257)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
