How to add multiple buttons to TinyMCE?

First add your additional buttons inside the buttons callback.. function register_button($buttons) { array_push($buttons, “quote”,”wpse-rules”); return $buttons; } Then add additional buttons function inside the plugin javascript.. init : function(ed, url) { ed.addButton(‘quote’, { title : ‘Add a Quote’, image : url+’/image.png’, onclick : function() { ed.selection.setContent(‘[quote]’ + ed.selection.getContent() + ‘[/quote]’); } }); ed.addButton(‘wpse-rules’, { title … Read more

Using WordPress’ WYSIWYG for comments

Give this a shot: <?php /* Add WYSISYG editor to comment form. */ add_filter( ‘comment_form_field_comment’, ‘wpse_64243_comment_editor’ ); function wpse_64243_comment_editor( $field ) { if (!is_single()) return $field; //only on single post pages. global $post; ob_start(); wp_editor( ”, ‘comment’, array( ‘textarea_rows’ => 15 ) ); $editor = ob_get_contents(); ob_end_clean(); //make sure comment media is attached to parent … Read more

tinymce is not defined when not using wp_editor

With help from a colleague, we dug through class-wp-editor.php Here are the necessary scripts to initialise jQuery tinyMCE if wp_editor has not been used beforehand (which calls these scripts). // Get the necessary scripts to launch tinymce $baseurl = includes_url( ‘js/tinymce’ ); $cssurl = includes_url(‘css/’); global $tinymce_version, $concatenate_scripts, $compress_scripts; $version = ‘ver=” . $tinymce_version; $css … Read more

How to use tinyMCE for user “biographical info”?

I found a very helpful blog post which shows exactly how to accomplish what I am after with only three small changes to the user-edit.php page. First Change I had to add a class name to the <textarea> tag for the description. <textarea name=”description” id=”description” rows=”5″ cols=”30″ class=”CLASS_NAME_HERE”><?php echo esc_html($profileuser->description); ?> </textarea><br /> Second Change … Read more

Enqueue Script After TinyMCE initialized

Adding scripts after TinyMCE: You might check out the before_wp_tiny_mce and after_wp_tiny_mcehooks. If you take a look at the file /wp-includes/class-wp-editor.php you can see that the TinyMCE settings scripts are not all loaded through the usual enqueue methods, but some are displayed via: add_action( ‘admin_print_footer_scripts’, array( __CLASS__, ‘editor_js’), 50 ); where the editor_js method contains … Read more

How to force TinyMCE in WordPress to replace newlines with tags and not with  

The answer suggested by GavinR is correct. You don’t need to install the suggested plug-in, though. Just add this mini plugin and you’re set: <?php defined( ‘ABSPATH’ ) OR exit; /* Plugin Name: TinyMCE break instead of paragraph */ function mytheme_tinymce_settings( $tinymce_init_settings ) { $tinymce_init_settings[‘forced_root_block’] = false; return $tinymce_init_settings; } add_filter( ‘tiny_mce_before_init’, ‘mytheme_tinymce_settings’ ); Now … Read more

Using wp_editor in shortcode

If a function echos data, you can use php output buffering to capture the echoed output and return it instead // Turn on the output buffer ob_start(); // Echo the editor to the buffer wp_editor(); // Store the contents of the buffer in a variable $editor_contents = ob_get_clean(); // Return the content you want to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)