Inserting a class on before_widget if checkbox is checked

Question

I have a check box showing on all widgets, a simple option to double the size of the widget on the frontent.

function doublesize_option( $widget, $return, $instance ) {
    $large = isset( $instance['large'] ) ? $instance['large'] : '';
    ?>
        <p>
            <input class="checkbox" type="checkbox" id="<?php echo $widget->get_field_id('large'); ?>" name="<?php echo $widget->get_field_name('large'); ?>" <?php checked( true , $large ); ?> />
            <label for="<?php echo $widget->get_field_id('large'); ?>">
                <?php _e( 'Double size', 'double_textdomain' ); ?>
            </label>
        </p>
    <?php} add_filter('in_widget_form', 'doublesize_option', 10, 3 ); function doublesize_save( $instance, $new_instance ) {
if (!empty( $new_instance['large'] ) ) {
    $new_instance['large'] = 1;
}
return $new_instance; } add_filter( 'widget_update_callback', 'doublesize_save', 10, 2 );

What I can’t seem to be able to do is insert a class on the widget frontend display something like

0
wally9 5 months 0 Answers 15 views 0

Leave an answer