get_calendar example

$custom_background_color          = _wp_array_get( $attributes, array( 'style', 'color', 'background' ), null );
    $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;

    // Generate color styles and classes.     $styles        = wp_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) );
    $inline_styles = empty( $styles['css'] ) ? '' : sprintf( ' style="%s"', esc_attr( $styles['css'] ) );
    $classnames    = empty( $styles['classnames'] ) ? '' : ' ' . esc_attr( $styles['classnames'] );
    if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
        $classnames .= ' has-link-color';
    }
    // Apply color classes and styles to the calendar.     $calendar = str_replace( '<table', '<table' . $inline_stylesget_calendar( true, false ) );
    $calendar = str_replace( 'class="wp-calendar-table', 'class="wp-calendar-table' . $classnames$calendar );

    $wrapper_attributes = get_block_wrapper_attributes();
    $output             = sprintf(
        '<div %1$s>%2$s</div>',
        $wrapper_attributes,
        $calendar
    );

    // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited     $monthnum = $previous_monthnum;
    
$title = apply_filters( 'widget_title', $title$instance$this->id_base );

        echo $args['before_widget'];
        if ( $title ) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        if ( 0 === self::$instance ) {
            echo '<div id="calendar_wrap" class="calendar_wrap">';
        } else {
            echo '<div class="calendar_wrap">';
        }
        get_calendar();
        echo '</div>';
        echo $args['after_widget'];

        self::$instance++;
    }

    /** * Handles updating settings for the current Calendar widget instance. * * @since 2.8.0 * * @param array $new_instance New settings for this instance as input by the user via * WP_Widget::form(). * @param array $old_instance Old settings for this instance. * @return array Updated settings to save. */
Home | Imprint | This part of the site doesn't use cookies.