Support » Plugins » Hacks » Making Toggle Open by Default on page load.

  • Hello. This is my toggle code (I think so atleast):

    **
    * Toggles
    *
    * @since 2.0.0
    *
    * @param array $atts Standard WordPress shortcode attributes
    * @param string $content The enclosed content
    * @return string $output Content to output for shortcode
    */

    if( ! function_exists( 'themeblvd_shortcode_toggle' ) ) {
    function themeblvd_shortcode_toggle( $atts, $content = null ) {
    $last = '';
    if ( isset( $atts[0] ) && trim( $atts[0] ) == 'last') $last = ' tb-toggle-last';
    $default = array(
    'title' => ''
    );
    extract( shortcode_atts( $default, $atts ) );
    $content = wpautop( do_shortcode( stripslashes( $content ) ) );
    $output = '<div class="tb-toggle'.$last.'">';
    $output .= '<span></span>'.$title.'';
    $output .= '<div class="toggle-content">'.$content.'</div>';
    $output .= '</div>';
    return $output;
    }
    }
    add_shortcode( 'toggle', 'themeblvd_shortcode_toggle' );

    What I want to do is make a toggle of my choice (if there is several) be open by default on page load, How would I do that?

    Thanks.

  • The topic ‘Making Toggle Open by Default on page load.’ is closed to new replies.