Current POD page and wp_page_menu
This might be really simple to solve... I have set up a pod, pod listing page and detail page as per instructions. These pages show up and link through fine. No issues here.
However, WordPress seems to nothing about the current page id or ancestry of any of my Pod Pages. So, the main menu gets out of sync - it is setting the current_page_parent item incorrectly as the default post page.
E.g. If click on an event and go to that detail page, in the main menu the 'News' item is highlighted as the current section. It should be 'Events'. The Url is showing correctly as /events/my-event
I'm using the Thematic framework which uses wp_page_menu to generate the menus.
I feel I'm missing something really obvious. Any ideas?
5 Answers
Thanks for the reply logikal16, I feared as much, but was hoping for an easy way out! I think the approach will be to query the pod id and then use jQuery to intercept the menu structure. If i get anywhere with this, I'll post it up.
Long story short, WordPress isn't aware that Pod Pages even exist. Unless there's a way to manually override "current_page_parent", you may have to add some CSS or Javascript to your Pod Page in order to change the active menu item.
any luck here Ian? I am looking for the same fix, and it feels very hacky to use JS and CSS to fix this. Isn't there a precode approach we could use in the templates to tell wordpress "this is the location of this page"?
I ended up using CSS to highlight the current top level menu item. I used a function which add a 'pods' class to the body tag which I think I got from this forum - copied below. Then I know if we're in a pods section and use CSS to apply the background image. Not great, and custom drop down menus are not assigned the current_page class.
What puzzles me is how come no-one else needs this functionality? Surely basic site navigation matters to everyone.
function pods_body_class($classes)`{
global $pods;
if (function_exists('is_pod_page')) {
if (is_pod_page()) {
$classes[] = "pod";
if( is_object($pods) )
{
$classes[] = "pod-".$pods->datatype;
}
$classes[] = ' '.pods_url_variable(-2).' '.pods_url_variable('last');
}
}
return $classes;}
add_filter('body_class','pods_body_class');
Pods adds Body Classes as of Pods 1.9.0
