0

How can I reveal hidden submenus on the page load in the Twenty Fifteen theme? I would like it so that all the submenus are open on every page. Can someone please guide me on how this can be achieved? Thanks

0

Figured it out! Use the following PHP code.

/*
 * Toggles the menu dropdowns to open state
*/
function mod_toggle_menus() {
    ?>
    <script type='text/javascript'>
    jQuery(document).ready( function() {

        /* add toggled-on class to submenus */
        jQuery('.sub-menu').addClass('toggled-on');

    });
    </script>
    <?php
}
add_action('wp_footer' , 'mod_toggle_menus');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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