WordPress The text editor can directly edit the code of the article, reduce the occurrence of errors, and greatly improve the efficiency. Editing in the visual interface often fails to achieve the desired results, which is more suitable for previewing after editing the text code. The two complement each other perfectly!
The default text editor has only a few commands, even no hierarchical title commands. Manual entry of these commands will be tedious and repetitive.
Now let's add some common button commands: The first level title, the second level title, the third level title, the code, and the code with line numbers are displayed in the WordPress topic functions? Php and?> Add the following code between. If you need other commands, you can add them.
/*Text Editor Custom Button*/ function appthemes_add_quicktags() { ?> <script type="text/javascript"> QTags. addButton ('First level title ',' First level title ','<h1>','</h1>'); QTags. addButton ('Secondary title ',' Secondary title ','<h2>','</h2>'); QTags. addButton ('Three level title ',' Three level title ','<h3>','</h3>'); QTags. addButton ('code ','code', '<pre>', '</pre>'); QTags. addButton ('code with line number ','code with line number', '<pre class="prettyprint linenumbers">', '</pre>'); </script> <? php } add_action('admin_print_footer_scripts', 'appthemes_add_quicktags' );
usage method:
Select the text, click the command, and the text will be enclosed by the command