Wordpress Code Editor Plugin

Code Editor Plugin for the Wordpress Code Editor

You can integrate plugins, themes and source code editors. Which you should consider in a code editor for WordPress development. Theoretically, you should never use the plugin editor to edit files. Editor to make changes to the downloaded file.

WordPress Code Editor

If you develop plug-ins, designs, or even customized plug-ins, you can give your customers the ability to add customized scripting or style. The WordPress software comes with its own code editor, so why not improve the usability by offering a great way to edit the code? Learn how to use the WordPress Code Editor and how to incorporate it into your own plugin or designs.

WordPress Code Editor feature set using WordPress Code Editor 4.9.0. In order to find out how to use this feature, see the code in wp-includes/general-template.php (online). While there are many preferences that you can modify, probably the most commonly used are the indent types and also the indent types like indeentUnit and tabSize.

It is also possible to apply the filters specified in the filters of a code editor to filters with the filters labeled by field name. There are 2 variable, $settings and $args in this parameter, $settings being the definitive setting and $args being the argument given to the command line editor. There' also an operation within this feature where you can include your own features and perhaps do something else related to the WordPress Code Editor. do_action('wp_enqueue_code_editor', $settings); Let's now make a plugin that uses the WordPress Code Editor with three sections:

Insert the next code into our PHP-files. These metaboxes will contain our textfield boxes and we need to queue the WordPress Code Editor script and style. In order to queue the required script, we will verify that we are on a page monitor. This can be a page for edit or create a new page. add_action('admin_enqueue_scripts','add_page_scripts_enqueue_script'); globally $post; wp_enqueue_code_editor( 'type' => 'text/html' ) ) ); wp_enqueue_script( 'js-code-editor', plugin_dir_url( __FILE__ ) .

/code-editor. js', array('jquery'),'', true ); When initialising the code editor we define the text/html typ. At the moment our standard texttarea boxes would be displayed in our standard box. In order to extend these boxes, we need to initialise the CodeMirror requested by the WordPress Code Editor. For every box we will verify that it exists.

In this case we will add our own to the CodeMirror defaults. You could specify these defaults in the arrays that you give when you call the functions wp_enqueue_code_editor. I' ve chosen to do this within our JavaScript code so you can see and study how to do it.

Use ' strict'; Var editorSettings = wp.codeEditor. standardSettings ? _. clone( wp.codeEditor. defaultSettings) : {} ; {} ; {}, pSettings editorSettings editorSettings codesmirror indeentUnit 2 tableSize 2 ModeSize : 2 editor editing wpSettings : wavascript setting file setting file setting file setting file setting file setting file setting var editor Editor = pSt_├ęditor_ditor_de_editor_p.code.js)

_.clone( wp.codeEditor. defaultSettings ) : {}; {}, editorSettings. codemirror, indentUnit: 2, tabSize: 2, mode:'css', ); var editor= wp.codeEditor. initialize( $('#code_editor_editor_page_css'), editorSettings ); ); }); }))(jQuery); most of the code is the same, except for the differences in modes. First of all, we clone the defaults so that we have no relation to the defaults.

This way we can modify our own standard setting objects without modifying anything within wp.codeEditor.defaultSettings. Then we extend the code mirror options with our own options. Then we initialize the WordPress Code Editor on the corresponding box with the new options. Please notice that the variables editor with this code refers here to the last initialized WordPress code editor.

To know the proper setting modus in JavaScript, verify the code of the command wp_enqueue_code_editor to see how to use it. Store meta-box contents. Returns; $scripts = $_POST['page_scripts']; update_post_meta( $post_id,'page_scripts', $scripts ); add_action('save_post','page_scripts_save_meta_box'); We do not analyze the code to verify and clean it here.

WorldPress will do this immediately after unpacking to ensure that the SQL is accurate and that the code entered does not corrupt the SQL Server as well. We will only show the code inside the elements using the hooks we call back and forth. add_action('wp_head','page_scripts_add_head'); * Put script in the header.

The first page_head code is output as it is, because it is a All HTML area. In the second case we put the code into the day, because we only allow the JavaScript code there. In the third case, we wrap the code in the styles tags.

Wp_unslash is also used on all of them, because WordPress uses additional forward bias when disinfecting the date before it is stored in the wp_unslash file. If you want to test the plugin without programming, you can get the plugin here. Since WordPress Code Editor is available at its heart, we do not need to use a JavaScript engine to enable code highlights in our plug-ins and designs.

You can also use the WordPress Code Editor to highlight the code we are writing in our online tutorials. But CodeMirror has a readyOnly feature. Did you try to use the code editor in your plugs or designs?

Mehr zum Thema