I’m working on a site where the Blog is actually a child page. When loading the blog it reflects the .current_page_parent class that’s supposed to be there via the Navigation, however when going into the article itself, there is absolutely no “current” type of display on the navigation.
How would I get the navigation to keep the blog as the “Child”?
For example: When going to /resources/blog on the site I’m working on – the nav information displays:
class=”menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor menu-item-30″
When going to a single article, the nav displays:
class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-30″
How do I get it to display any of the “page parent” information on single.php?
do you have a link or a screenshot of the issue? It is more easy to find a solution when we understand 100% the pb ;0)
if your theme uses body_class() in the body tag there will be a .blog class in the main blog page and a .single class in single post pages, that could be used to target menu items.
@dwnfred – The site is located:
You’ll notice when you load the blog that “Resources” is highlighted on the Navigation (built with the internal Menu – Appearance > Menus). When you click on the “Read More”, it brings you to the single article, but the navigation is no longer highlighted and if you inspect the element, it’s basic menu class information, nothing with a ‘current_page’ or ‘page_parent’ that can be customized to reflect the necessary highlight on that nav section.
I don’t personally agree with having the blog as a child page, but it’s what the client wants so I don’t know where to go from here.
@ben – I’m not using body_class(), I’ve built the template completely from scratch so I honestly wouldn’t even know where to put body_class() as I’ve never used it before.
:: bump ::
Any idea on how to go about fixing this? Clients deadline is this evening and I’m not sure how to handle the highlighting issue.
@ben – Thank you for the recommendation on body_class(), I was able to figure everything out with that tag, it’s working perfectly now. Thanks again.
I am unable to edit the post from 11 hours ago as I went far past the 60 minute edit window. I was unaware of an NDA with this client (as I am a sub-contractor). Can someone please remove the link before legal matters pop up? I’m sorry, I’ve never asked for anything like this before but I’m in a jam. Please assist?
I’ll remove that link for you this time, but next time, I won’t. So don’t do that again.
If you post anything, then it’s public. This site is very well indexed by Google, and I can’t edit their caches. When you make a post here, Google has it *minutes* later.
- The topic ‘Blog is "Child", how to load on WP Menu?’ is closed to new replies.