Jump to content
Sign in to follow this  
cstudio

Nav menu, blog page shows as active page when on custom Taxonomy.

Recommended Posts

cstudio

I am not sure if this is a pagelines issue or a greater Wordpress issue, but I am going to ask the question here first because everyone here has been right on with solutions. I have a custom post type 'listings' and a hierarchical custom taxonomy 'status', with options ' active ' and ' sold '. The problem I am having is when on a archive page for the custom taxonomy 'status' the blog page also show as active in the navigation menu. Example is http://www.golding.com/status/sold/ Any Ideas, would be appreciated. Thanks

Share this post


Link to post
Share on other sites
Rob
Are you creating this property listing system yourself, or, is it a plugin? I see your problem but I'm unsure how to help you fix it. If it's a plugin, you may want to write the plugin author and get their input. If you created this yourself (well done) but you might want to use a real estate plugin or hire one of our Pros to help you set up the right navigation between taxonomies. This just seems like the system doesn't have anything set up to distinguish sold properties from the rest of them so they don't re-appear in current listings.

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
cstudio
This is not a plugin. I made it myself based on custom post type and custom taxonomies. The system can tell the difference between sold and active listings, but when you are on one of those pages that is within the taxonomy 'status' the blog page is also showing as the active page. [img]http://www.castshadow.co/testwater/Screen%20Shot%202012-04-04%20at%202.59.22%20PM.png[/img] I just found a post about a simular issue with custom post types. [url]http://wordpress.org/support/topic/why-does-blog-become-current_page_parent-with-custom-post-type[/url] The function to fix the problem seem to be. [code]// As of WP 3.1.1 addition of classes for css styling to parents of custom post types doesn't exist. // We want the correct classes added to the correct custom post type parent in the wp-nav-menu for css styling and highlighting, so we're modifying each individually... // The id of each link is required for each one you want to modify // Place this in your WordPress functions.php file function remove_parent_classes($class) { // check for current page classes, return false if they exist. return ($class == 'current_page_item' || $class == 'current_page_parent' || $class == 'current_page_ancestor' || $class == 'current-menu-item') ? FALSE : TRUE; } function add_class_to_wp_nav_menu($classes) { switch (get_post_type()) { case 'motion': // we're viewing a custom post type, so remove the 'current_page_xxx and current-menu-item' from all menu items. $classes = array_filter($classes, "remove_parent_classes"); // add the current page class to a specific menu item (replace ###). if (in_array('menu-item-592', $classes)) { $classes[] = 'current_page_parent'; } break; case 'still': // we're viewing a custom post type, so remove the 'current_page_xxx and current-menu-item' from all menu items. $classes = array_filter($classes, "remove_parent_classes"); // add the current page class to a specific menu item (replace ###). if (in_array('menu-item-348', $classes)) { $classes[] = 'current_page_parent'; } break; // add more cases if necessary and/or a default } return $classes; } add_filter('nav_menu_css_class', 'add_class_to_wp_nav_menu');[/code] This seems to fix a problem of custom post types doing the same thing. I will see if I can play around with it to work for custom taxonomies. Any Idea's Thanks

Share this post


Link to post
Share on other sites
cstudio
I solved the issue. It is a very easy work around no code. This is a Wordpress issue, not pagelines. I found a good post on how to create a setting panel in wp-admin to fix and fine tune this, but it is a project for another day. [url]http://network.defaulttricks.com/setting-active-navigation-elements-when-wordpress-doesn%E2%80%99t.html[/url] I removed my 'blog' 'page' from my menu. Then readded it as a 'custom link' instead of a 'page'. I hope that make sense, but it worked for me for now. problem [img]http://www.castshadow.co/testwater/Screen%20Shot%202012-04-04%20at%202.59.22%20PM.png[/img] fixed [img]http://www.castshadow.co/testwater/Screen%20Shot%202012-04-04%20at%204.29.57%20PM.png[/img] Thanks for you help.

Share this post


Link to post
Share on other sites
Rob
Actually, that made perfect sense and I wish I knew that's how you created your link. However, I doubt I'd have figured it out. You did well. Accolades for your tenacity and dedication!

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
cstudio
Thanks for your help. I am glad it was a simple clean fix. I hope this help someone in the future.

Share this post


Link to post
Share on other sites
robmat79
Thanks for your help on this one, had me stumped until I found this post

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×