Missing current_page_parent css class for custom post types
-
Hi folks
I’ve searched the wordpress trac for this issue, but I find only related posts to the new wp_nav menu feature.
I’m currently working on a plugin to manage my portfolio with a custom post type, taxonomies for elements and so on. I love the new features, and it works pretty well.
But one thing doesn’t seem to work properly or I’m to much brain afk at the moment to find the solution. Same old story as for regular posts in version <2.9 I think.
I’ve created a custom post type “portfolio”. In a separate page-template “portfolio.php”, I return all elements with a link to a single-portfolio.php template. The redirection is made with the following function in my plugin file.
function template_redirect() { global $wp; if (in_array('post_type', $wp->query_vars) && $wp->query_vars['post_type'] == "portfolio") { include(TEMPLATEPATH . "/single-portfolio.php"); die(); } }
The redirection works, but the css class “current_page_parent” isn’t applied to the Portfolio Menu button, when I’m browsing the single-portfolio.php page.
Is there a way to define a parent page for a custom post type? Or in other words: How can I tell wordpress that the single-portfolio template is a child of portfolio.php? How does this work for the default post type “post”?
PS: And sorry for my bad english, I’m swiss.
– rofflox
- The topic ‘Missing current_page_parent css class for custom post types’ is closed to new replies.