Collapsed or expanded on page-load for specific pages
-
Hello!
I am working on a site that incorporates collapse-o-matic as a sidebar menu that incorporates multiple menu items and sub-menus (i.e. Menu 1 > item 1 * item 2 * item 3 * item n >>> Menu 2 > item 1 * item 2 * item n). As part of the menu, the client wants it expanded if an item of that menu is active. For example, if the “staff” page under the “Company” menu is visited, the menu for “Company” would be expanded by default (and other menus would remain collapsed).
The code I have so far is below:
<?php if (is_page( array( 1, 2, 3, 4, 5, 6, 7 ))) { $expand='true'; } else { $expand=' '; } echo do_shortcode( '[expand title="Meaningful Use" expanded="'.$expand.'" ]' ) ; ?> content <?php echo do_shortcode( '[/expand]'); ?>
If I am actively visiting pages OTHER than 1 – 7 (as in the above example), the menu remains expanded by default. I would like to see it expanded only when those pages are active.
Has anyone attempted anything similar?
Thank you for your time.
https://www.ads-software.com/plugins/jquery-collapse-o-matic/
- The topic ‘Collapsed or expanded on page-load for specific pages’ is closed to new replies.