Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In Settings-Reading I have selected a static page from my "Front page displays". My Front page is "Home" and my Posts page is "News".

I have also added a Custom Post Type called "Project" without an archive or a slug and I have added a page "Projects" which uses the template projects.php.

So far so good, all is working, except one thing.

When I visit a single Project (CPT), in my top navigation "News" becomes selected. In the body-tag it gets the class single single-project postid-114 single-format-standard logged-in

And in the nav-menu News has a class of page_item page-item-6 current_page_parent.

I don't understand why this (News getting the current_page_parent-class) would be happening, as I expected that none of the page_items would become selected.

Two questions:

  1. How can I get rid of this?
  2. And ideally, how can I make it so that "Projects" becomes selected?

Below a screenshot to (hopefully) clarify things.

enter image description here

share|improve this question
    
forgot to mention that it is a non-hierarchical post type & large image via: img.skitch.com/20110623-8gs8e2cx6eeb2qgata5mn8s7j.jpg –  Piet Jun 23 '11 at 3:52
add comment

1 Answer

up vote 0 down vote accepted

Might be worth looking at the Codex for registering a post type, the rewrite rule should help:

http://codex.wordpress.org/Function_Reference/register_post_type

rewrite (boolean or array) (optional) Rewrite permalinks with this format. False to prevent rewrite. Default: true and use post type as slug $args array 'slug' - prepend posts with this slug - defaults to post type's name - use array('slug'=>$slug) to customize permastruct 'with_front' - allowing permalinks to be prepended with front base (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/) - defaults to true 'feeds' - default to has_archive value 'pages' - defaults to true

You probably want to set with_front to false.

share|improve this answer
    
Thanks @Alex, I probably totally messed up here, I should indeed do something with it, otherwise I end up with the default values. Don't know what I was thinking! –  Piet Jun 23 '11 at 9:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.