wp_render_widget example

'id_base'       => $parsed_id['id_base'],
            'sidebar'       => $sidebar_id,
            'rendered'      => '',
            'rendered_form' => null,
            'instance'      => null,
        );

        if (
            rest_is_field_included( 'rendered', $fields ) &&
            'wp_inactive_widgets' !== $sidebar_id
        ) {
            $prepared['rendered'] = trim( wp_render_widget( $widget_id$sidebar_id ) );
        }

        if ( rest_is_field_included( 'rendered_form', $fields ) ) {
            $rendered_form = wp_render_widget_control( $widget_id );
            if ( ! is_null( $rendered_form ) ) {
                $prepared['rendered_form'] = trim( $rendered_form );
            }
        }

        if ( rest_is_field_included( 'instance', $fields ) ) {
            $widget_object = $wp_widget_factory->get_widget_object( $parsed_id['id_base'] );
            

function render_block_core_legacy_widget( $attributes ) {
    global $wp_widget_factory;

    if ( isset( $attributes['id'] ) ) {
        $sidebar_id = wp_find_widgets_sidebar( $attributes['id'] );
        return wp_render_widget( $attributes['id']$sidebar_id );
    }

    if ( ! isset( $attributes['idBase'] ) ) {
        return '';
    }

    $id_base       = $attributes['idBase'];
    $widget_key    = $wp_widget_factory->get_widget_key( $id_base );
    $widget_object = $wp_widget_factory->get_widget_object( $id_base );

    if ( ! $widget_key || ! $widget_object ) {
        
Home | Imprint | This part of the site doesn't use cookies.