Associate Primary vs Secondary Menu in TwentyEleven / Widget Logic
-
Hello all!
I’m developing my first site with TwentyEleven theme on my local machine and so far successfully set up a secondary menu, which I’ve styled via my child theme CSS and added to the Custom Menu widget.
Here’s where I’m stuck:
1. Using Widget Logic I’ve so far been unable to restrict the pages where the secondary menu is shown. I only want to show the secondary menu on 1 page and its child pages – nowhere else on the site.
I’ve used this code but no joy:
is_page(‘stories’) && global $post; return in_array(33,get_post_ancestors($post)));
(page slug is ‘stories’ and its page id is 33)
I also tried to test this by only showing the widget on the homepage using the simpler is_home(); however doesn’t seem to work either.
2. I’ve styled the secondary menu and it all looks ok. However I would like to create an association between both menus such that when I click on a page in the secondary menu it recognises that I am still in the same section by highlighting ‘Stories’ in the primary menu.
e.g. Primary Menu Items: Home Stories Blog
Secondary Menu: All Cats Dogs– All items in secondary menu are below Stories
– When I click on All / Cats / Dogs I would like to highlight ‘Stories’ in the primary menuI hope this makes sense! A big thank you in advance to anyone who’s kind enough to help and apologies if there is any confusion…
- The topic ‘Associate Primary vs Secondary Menu in TwentyEleven / Widget Logic’ is closed to new replies.