WordPress.org

Ready to get started?Download WordPress

Forums

Collapsible Widget Area
Accordions closed by default (3 posts)

  1. Mike
    Member
    Posted 2 years ago #

    Any way to make the accordions start off closed by default?

    Thanks.

    http://wordpress.org/extend/plugins/collapsible-widget-area/

  2. Curtiss Grymala
    Member
    Plugin Author

    Posted 2 years ago #

    There is no option to accomplish this easily, but you might be able to do so with a little extra JavaScript.

    You might be able to do so with some code like the following in your theme's functions.php file.

    add_action( 'wp_print_footer_scripts', 'start_collapsible_closed', 2 );
    function start_collapsible_closed() {
    ?>
    <script type="text/javascript">
    jQuery( function( $ ) {
        $( '.collapsible-widget-container' ).accordion( "option", "collapsible", true );
        $( '.collapsible-widget-container' ).accordion( "option", "active", false );
    } );
    </script>
    <?php
    }

    I haven't tested that, but it appears it should work. A warning about this, though: if you change the settings for the plugin so that it uses a tabbed interface instead of the accordion interface, this code will probably start throwing JavaScript errors.

    I'll look into adding this as an option in the plugin itself. Thanks for the suggestion.

  3. bthabault13
    Member
    Posted 2 years ago #

    Hello,

    Great plugin!

    I added this code and didn't see any effect, is there anyway you could test it out and see if there is an error?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic