I’m currently using <?php wp_list_pages('title_li='); ?> and <?php wp_list_categories('child_of=X') ?> to display a menu and submenu structure. Each page has an individual template to display posts from the individual category’s children, and ‘X’ represents the category ID.
Hoping you can help me with the next step though: when viewing a single post (single.php) I am unable to display the submenu because I do not know how to detect the current post’s category. I also lose the current_page_item class from the main menu, which affects my styling.
Is there a better way to have a navigation that lists pages (with current_page_item styling) as well as a submenu that automatically detects the current category and lists the children, even for single posts?
All help appreciated!
Unfortunately this site is only running locally at the moment, so I can’t provide a URL.
The topic ‘Customising navigation for single.php’ is closed to new replies.