I’ve found with custom post types that when you’re on a page for the custom post type that the Blog Page’s menu item is given the current_page_parent class which in my case makes it highlighted so it appears as though you’re within that section.
Seems to happen for custom post types and bbpress forums as well as buddypress groups.
Any thoughts?
Original ticket on bbpress – https://bbpress.org/forums/topic/viewing-forum-pages-makes-blog-menu-item-the-current_page_parent/
Thanks
]]>I have a WordPress menu, where I need the parent item to remain Active when the Child menu items (or pages) are active.
I can’t figure out how to make it work.
Please can someone explain the CSS i need.
I read this, but it’s not helping:
https://css-tricks.com/forums/topic/keep-parent-item-active-when-child-element-is-current-page-csswordpress/
Here is my HTML
*******
<li id=”menu-item-67″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-67″><span>CLIENTS</span>
<ul class=”sub-menu” style=”float: none; width: 12em; display: none;”>
<li id=”menu-item-20″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-20″ style=”float: left; width: 100%; white-space: normal;”><span>The List</span>
<li id=”menu-item-19″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-19″ style=”float: left; width: 100%; white-space: normal;”><span>What They Say</span>
********
There are one parent menu “CLIENT”.
And two children “The List” and “What they say”.
When the children pages are selected, I need “CLIENT ” to by styled “color:red”
Thanks for showing me how to do this.
If it helps, I’m using this theme:
https://dreamthemedesign.com/themes/u-design/portfolio/one-column-portfolio/
(notice when a child is selected, the parent is NOT style orange…I need that!)
Thanks!
J.
]]>function noCurrentNavInSearch( $content ) {
if ( is_search() ) $content = preg_replace( '/ current_page[_a-z]*([\" ])/', '\1', $content );
if ( is_404() ) $content = preg_replace( '/ current_page[_a-z]*([\" ])/', '\1', $content );
return $content;
}
add_filter( 'wp_list_pages', 'noCurrentNavInSearch' );
Can any one give me a function that will work with the latest versions of WP?
]]>I have wordpress seo by Yoast activated, so I would like to deactivate all-in-one-seo but unless i keep it activated, i loose the functionality of my menu!
What is going on? Can I fix it? My site is www.properties247.co.uk
]]>I am really stuck and cannot find a solution. Please can any one hel?
]]>wp_list_pages("title_li=&child_of=$parent&depth=0");
For some reason it now reloads the entire menu every time you click on a menu item. It used to just add the menu items, no reloading the entire menu. I tried some CSS to fix it, but it’s problematic once you get 3 or more levels down. Anyone having a similar problem or know how to fix it?
]]>I recently updated my theme and my WP installation, so I am not sure which caused this problem, but it was working fine. Mainly, my side navigation used to display (top and sub-levels) and highlight appropriately (current page item), then it started doing this weird thing that when you clicked on a parent level, or a subnavigation menu item that was in a submenu already displayed, it reloaded the entire side menu again. To fix this I used the following code:
#left ul li ul{ display: none; }
#left li.current_page_parent ul { display: block !important;}
This seemed to do the trick, and it does for the first and second levels of my side navigation, but when you drill down to the third level and below, all of the third level menus get displayed, even for items that are not currently active.
This code fixes that:
#left li.current_page_parent ul.children li.current_page_item { display: block !important;}
But then you get the reloading of the entire menu again. If you look here you will see what I mean: https://arboretum.harvard.edu/library/image-collection/the-arnold-arboretum-captured-in-time-1982-1987-photographs-by-corliss-knapp-engle/
I hope this makes sense, and if anyone can help out I would really appreciate it, I am stuck.
Thanks!
Donna
On my HOME page for some reason the NEWS (posts) page is getting the class ‘current_page_parent’ from ‘wp_list_pages’ in the nav. So on the HOME page the nav menu shows the news link highlighted…
I have options > reading set to use a static page (home) and my posts page set to News
Can anyone explain why this is happening?
Thanks,
Thomas
I’m using he following solution in functions.php to allow sustom single post templates
// allow single post page templates
add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->term_id}.php") ) return TEMPLATEPATH . "/single-{$cat->term_id}.php"; } return $t;' ));
Hover if i click on a case study for example – to view it’ single post, it used the correct template (in this case single-5.php) but the current_page_parent class from my main nav (using wp_page_menu) switches to the main blog section.
Does anyone know of a way to force each single post template to set the correct ‘current_page_parent’ in the main menu?
Many many thanks
Mark