Text Editor Tags
Text Editor Tags
Text Editor Tags
I wrote a jQuery plugin to check every 0.5 seconds if the toolbar has the requested element. (function( $ ) { /** * Wait until element has finish loading requested elements, then execute callback * @param string element Element to wait for * @param object callback Callback to execute * @param integer timeout Optional timeout … Read more
It’s a simple solution/workaround, but a Shortcode could be used. As birgire noted, the whole anchor can be the Shortcode. And for ease of use, this article has a solution: adding a shortcode button in TinyMCE. You could have a dropdown with a selection of anchors, turning the fight in your favor 😉 WP editor … Read more
gdaniel answered the bulk of question with this comment: Every time you type Enter (the return character) the editor creates a new paragraph <p>my content</p>, the alternative is to type Shift+Enter so that the editor creates a line break (<br/>) instead. Note that the the <br /> and </p> tags are added via wpautop, one … Read more
Without seeing your code I can’t say whats wrong but here is a working (tested) example of a metabox with an editor inside that has the visual/text tabs. add_action( ‘add_meta_boxes’, function() { add_meta_box(‘html_myid_61_section’, ‘Meta Box Title’, ‘my_custom_meta_function’); }); function my_custom_meta_function( $post ) { $text= get_post_meta($post, ‘my_custom_meta’ , true ); wp_editor( htmlspecialchars_decode($text), ‘mettaabox_ID’, $settings = array(‘textarea_name’=>’inputName’) … Read more
I assume you are using the text editor… The example with the blank line in your question would normally be converted by WP to this: <ol> <li>Paragraph 1 : text <p> Some more text</p></li> <li>…</li> </ol> Wpautop wraps the 2nd line with the p element because of the blank line you created. Your example of … Read more
Here’s an easy way to achieve what you wanted: From the edit callback, return a class which extends the ClassicEdit component used with the Classic editor block. And in your block’s attributes, make sure content is set (in the question, it’s blockValue). Tried and tested working properly: var el = wp.element.createElement; var ClassicEdit; // An … Read more
Simple example that will add a Quicktag button that calls a Javascript function when it is clicked… <?PHP function _add_my_quicktags(){ ?> <script type=”text/javascript”> QTags.addButton( ‘alert’, ‘Alert Button’, simple_alert ); function simple_alert() { alert(‘hello, example callback function’); } </script> <?php } add_action(‘admin_print_footer_scripts’, ‘_add_my_quicktags’); ?> UPDATE…. Adding a Callback function that utilizes the passed in variables… // … Read more
You have to format the output: echo wpautop( stripslashes ( $options[‘information’] ) ); see: https://codex.wordpress.org/Function_Reference/wpautop
Solved it: function add_placeholder_event( $html ){ $screen = get_current_screen(); $post_type = $screen->post_type; if( $post_type == ‘event’ ) { $html = preg_replace(‘/<textarea/’, ‘<textarea placeholder=”John Doe” ‘, $html); } return $html; } add_filter(‘the_editor’,’add_placeholder_event’);