Tag Info

Hot answers tagged

4

Add Dashicon All buttons inside the TinyMCE have a class, also your custom button. Include (use wp_enqueue_style() a stylesheet with styling with Dashicons, like the follow example. .myicon:before { content: '\2605'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'dashicons'; vertical-align: top; } On ...


3

You can filter the TinyMCE body classes to add or change as needed. It's a string that's pre-populated with some things like post type, so the easiest thing to do is append your additional classes (with a preceding space). <?php function wpse_128380_tinymce_body_class( $mce ) { // you could do things here to detect whatever you need // and use ...


3

The main problem are the missing scripts. The scripts enqueued in _WP_Editors::enqueue_scripts() are never printed. The same is true for _WP_Editors::editor_js(). So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: T5 AJAX Editor. There is one class named Ajax_Editor. Its method render() prints the ...


2

To style the icons using the Dashicons CSS files that are already loaded in the WP dashboard requires adding some extra CSS. In the latest beta of Wordpress (3.9), TinyMCE 4.0 is used so I'm not sure this will work on earlier versions (however a modified version may suit, adjusting for the different classes outputted by previous TinyMCE buttons). In WP 3.9 ...


2

That can be achieved with the hooks edit_form_after_title and edit_form_after_editor and proceed like a meta box. I noticed a "glitch", though, if you swap Visual/Html in the custom wp_editors and then publish/refresh the page, their state will be the same as the main editor (the post content). Adjust the post type, page in this example. add_action( ...


2

If you are using the settings API, you can use exactly the same code for calling wp_editor as you would anywhere else I've test the code below, it adds a setting section to the reading section, and then adds a field to the section containing a WYSIWYG editor with buttons limited to link, img and close // Add a setting to the reading page function ...


2

This isn't as good as line numbers but you can add a dummy class every so often. #_________section_1 { display: none; /* Just in-case it strips the empties */ }; It may help you to quickly scroll to the relevant section. To be honest though, you should have a mirror of your site stored locally and only change the online version when you're 100% ...


2

I would use the phrase Nested Shortcodes to describe it. You can find many questions using that phrase here on WPSE. The Codex also uses it, for example here: http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes Since the shortcodes in your example are related to the layout, we could perhaps call it: Nested Layout Shortcodes to be ...


2

If you just want to get rid of the \ characters in the string that's returned, you can use PHP's stripslashes(): $content = stripslashes( $content ); I'd recommend doing this on output rather than on input; WordPress adds the slashes as it sanitizes your data on insert, per update_option()'s Codex page, The $option (option name) value is escaped with ...


1

$settings = array( 'tinymce' => array( 'width' => 200 ) ); Gives you a tinymce that's 200px wide. Found it here: http://www.tinymce.com/wiki.php/Configuration When I tried it the background color of my tinymce changed. So maybe you have to tweak that.


1

You must filter the content inside the editor, if you save the content. Alternativly add a tiny button to add content from MS Word inside the editor area. I think for the usability is it better, if you filter the content from users on save his content. You can use the project WordOff to filter the content from MS Word and create clean html. Alternative ...


1

This is, as you guessed, default behavior. It's stored in the wp_usermeta table for each user in the wp_user-settings meta_key and does not differentiate between different editor instances. On a side note, the tinymce version of wp_edior() does not cooperate very well with being inside a meta box. Especially if the metabox is moved, or hidden then shown, ...


1

Remove post type support for the editor: add_action( 'init', function() { remove_post_type_support( 'post', 'editor'); } ); Now add a new meta box containing only a textarea // print a new meta box function generic_cb($post) { $content = (!empty($post->post_content)) ? $post->post_content : ''; echo '<textarea ...


1

Making this an answer so that others can find it: PHP's native function stripslashes() will translate \" back to " (as well as removing the backslash character from other escaped characters, and changing \\ into \).


1

The following code works for me, it adds an options page, and adds a WYSIWYG box to that page, with ONLY 3 quicktags: link, img and close, and nothing else. Note, I turned of tinyMCE, and passed a settings array (which contains another array for quicktag settings) to wp_editor. By passing in unique id of the textarea field, it will only affect the correct ...


1

Did you tried echo wpautop($quote);? It's made to work with TynMCE Visual editor. BTW, I recommend you to use the awesome class https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress


1

Yeah this is a fun one had to make some mods to make this one work.... add this to your theme stylesheet (style.css): .ui-front { z-index: 1001 !important; } .ui-widget-overlay { background: none repeat scroll 0 0 #000000 !important; opacity: .6 !important; filter: Alpha(Opacity = 60) !important; } This ...


1

Your jQuery code is using the $ symbol without accounting for noConflict mode. More information: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers


1

Maybe you should just add a custom field to accept the url itself, in stead of the wp_editor textarea; then append the video embed after you work with the input. Let me know if you need any help setting that up. OR: You could add a separete textarea to accept just comma separated or line-break separated urls (Because you stated below that you might need ...


1

Try this: replace 'theme_advanced_disable' => 'fullscreen' with 'toolbar1'=> 'bold,italic,underline,bullist,numlist,link,unlink,forecolor,undo,redo' Also, remove 'teeny' => true,


1

This ended up working for me, uses the tinyMCE init filter to remove the 'statusbar' entirely. /** Edit TinyMCE **/ function myformatTinyMCE($in) { $in['statusbar'] = false; return $in; } add_filter('tiny_mce_before_init', 'myformatTinyMCE' ); Even with CSS, I couldn't find a way to definitely remove the path but keep the status bar - here's the ...


1

This should do the trick: remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize');


1

I'm not good with English, but the answer is that the editor class calls the scripts needed in the admin footer (wp-includes/class-wp-editor.php line 160) : add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js'), 50 ); add_action( 'admin_footer', array( __CLASS__, 'enqueue_scripts'), 1 ); So when you call the wp_editor function in your ...



Only top voted, non community-wiki answers of a minimum length are eligible