wp_enqueue_code_editor example

                    'theme' => $stylesheet,
                    'file'  => $relative_file,
                ),
                admin_url( 'theme-editor.php' )
            )
        );
        exit;
    }
}

$settings = array(
    'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
);
wp_enqueue_script( 'wp-theme-plugin-editor' );
wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
wp_add_inline_script( 'wp-theme-plugin-editor', 'wp.themePluginEditor.themeOrPlugin = "theme";' );

require_once ABSPATH . 'wp-admin/admin-header.php';

update_recently_edited( $file );

if ( ! is_file( $file ) ) {
    $error = true;
}

    public $editor_settings = array();

    /** * Enqueue control related scripts/styles. * * @since 4.9.0 */
    public function enqueue() {
        $this->editor_settings = wp_enqueue_code_editor(
            array_merge(
                array(
                    'type'       => $this->code_type,
                    'codemirror' => array(
                        'indentUnit' => 2,
                        'tabSize'    => 2,
                    ),
                ),
                $this->editor_settings
            )
        );
    }
$instance['content'] = wp_kses_post( $new_instance['content'] );
        }
        return $instance;
    }

    /** * Loads the required scripts and styles for the widget control. * * @since 4.9.0 */
    public function enqueue_admin_scripts() {
        $settings = wp_enqueue_code_editor(
            array(
                'type'       => 'text/html',
                'codemirror' => array(
                    'indentUnit' => 2,
                    'tabSize'    => 2,
                ),
            )
        );

        wp_enqueue_script( 'custom-html-widgets' );
        wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );

        

);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-editor-screen/">Documentation on Editing Plugins</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://developer.wordpress.org/plugins/">Documentation on Writing Plugins</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);

$settings = array(
    'codeEditor' => wp_enqueue_code_editor( array( 'file' => $real_file ) ),
);
wp_enqueue_script( 'wp-theme-plugin-editor' );
wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.themeOrPlugin = "plugin";' ) );

require_once ABSPATH . 'wp-admin/admin-header.php';

update_recently_edited( WP_PLUGIN_DIR . '/' . $file );

if ( ! empty( $posted_content ) ) {
    $content = $posted_content;
}
Home | Imprint | This part of the site doesn't use cookies.