0

So I have a Custom Post Type setup and running with no issue. I also have a WordPress menu object as my primary navigation. I added my Custom Post to the main menu and when I click on to the landing page the correct menu item is highlighted. When I however click into an individual custom post, the "Blog" menu item is highlighted.

Anyone got any idea as to what the frick is going on?

Thanks, Ed

2 Answers 2

1

I'm just shooting in the dark here, but what i think is going on is your menu "thinks" its on the blog page when its really on the "CPT" page? is that about right? if so then you need to select a blog page in the admin section. Under the Settings menu click on the "Reading" sub menu. There you will find two select boxes. I'd suggest you select a specific page for your home page and your blog page. see if that corrects the issue.

I'm not even in the right ball park, please let me know.

1
  • I already tried that Steve - it didn't work. You've nailed exactly what the issue is though. I'll keep playing around with it.
    – Colm Troy
    Aug 20, 2011 at 16:03
1

i eventually managed to track down what's going on here and have worked around it for the moment until I find a permanent solution.

as @Steve Fischer had suspected the menu thinks it's on the blog page while it is in fact on a CPT page. What exactly is happening is that the class "current_page_parent" is being appended to my Blog menu link on CPT details pages.

e.g.

mysite.com/custom-post-menu-link/ - all good - my separate Blog menu link doesn't get the current_page_parent class.

mysite.com/custom-post-menu-link/my-custom-post - my separate Blog menu link gets the current_page_parent class.

For now I just removed my selector rules for .current_page_parent but this isn't a permanent solve - it at least stops the Blog menu link being highlighted incorrectly.

Are CPT pages technically children of Blogs? If so, this seems to be an issue for people in my situation.

Ed

1
  • So you've actually taken someone's answer, added it as your own, and then 'your' answer has been upvoted.. I Find this incredibly unfair on Steve to be honest, he should get credit for his answer, and in fact get the accepted answer. THIS is the problem you are having.
    – Lee
    Apr 3, 2019 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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