2013-09-16

Examples: Fixed closing pre problem by encoding "less than" symbol. Removed warning.

← Older revision

Revision as of 11:37, 16 September 2013

(One intermediate revision not shown)

Line 9:

Line 9:

 

The Quicktags API allows you to include additional buttons in the Text (HTML) mode of the WordPress editor.

 

The Quicktags API allows you to include additional buttons in the Text (HTML) mode of the WordPress editor.

 

 



This page was proposed on the WP DEVEL blog here: http://wpdevel.wordpress.com/2011/12/07/whats-new-javascript-in-3-3/ And the relevant Trac ticket is http://core.trac.wordpress.org/ticket/16695

+

This page was proposed on the [http://wpdevel.wordpress.com/2011/12/07/whats-new-javascript-in-3-3/ Make WordPress Core]. A relevant Trac ticket is [http://core.trac.wordpress.org/ticket/16695 16695]

 

 

 

[[Image:quicktags-editor.png‎‎|full|center|WordPress Text editor buttons]]

 

[[Image:quicktags-editor.png‎‎|full|center|WordPress Text editor buttons]]

Line 44:

Line 44:

 

QTags.addButton( 'eg_paragraph', 'p', '<p>', '</p>', 'p', 'Paragraph tag', 1 );

 

QTags.addButton( 'eg_paragraph', 'p', '<p>', '</p>', 'p', 'Paragraph tag', 1 );

 

QTags.addButton( 'eg_hr', 'hr', '<hr />', '', 'h', 'Horizontal rule line', 201 );

 

QTags.addButton( 'eg_hr', 'hr', '<hr />', '', 'h', 'Horizontal rule line', 201 );



QTags.addButton( 'eg_pre', 'pre', '<pre lang="php">', '</ pre>', 'q', 'Preformatted text tag', 111 );

+

QTags.addButton( 'eg_pre', 'pre', '<pre lang="php">', '</pre>', 'q', 'Preformatted text tag', 111 );

 

</script>

 

</script>

 

<?php

 

<?php

Line 51:

Line 51:

 

add_action( 'admin_print_footer_scripts', 'appthemes_add_quicktags' );

 

add_action( 'admin_print_footer_scripts', 'appthemes_add_quicktags' );

 

</pre>

 

</pre>



 



(Note: We purposely added a space in </ pre> so the example code above would render correctly. You’ll need to remove it in order for the tag to work in your code.)

 

 

 

 

(Note: to avoid a Reference Error we check to see whether or not the 'quicktags' script is in use.)

 

(Note: to avoid a Reference Error we check to see whether or not the 'quicktags' script is in use.)

Show more