Tag Info

Hot answers tagged

4

Actually you can include the editor-style.css (or any other stylesheet), just pass a "content_css" value to tinymce that points to a css file: wp_editor( $content, 'editablecontent', array( 'tinymce' => array( 'content_css' => get_stylesheet_directory_uri() . '/editor-styles.css' ) ); So the original ...


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 ...


3

Short answer: Because there is a hidden widget where the TinyMCE appears first. Long answer (sorry, a very long answer): Go to the Codex and copy the example widget Foo_Widget to make sure we are talking about the same code. Now open your IDE (not an editor) and write a short testing widget as plugin. Starting with a minimal plugin header... <?php /* ...


3

The editor is hard-coded into the form. It isn't inserted by add_meta_box. There is a hook called edit_form_after_title which you should be able to use though. Proof of concept: // use the action to create a place for your meta box function add_before_editor($post) { global $post; do_meta_boxes('post', 'pre_editor', $post); } ...


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

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 ...


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 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

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( ...


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

It's quite possible to accomplish tinyMCE in widget. In fact it has been already done. The reason why simply calling wp_editor() doesn't work in widget form is that form markup is asynchronously delivered using AJAX. Try searching here for more details.


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

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

$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

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

To answer my own question, I'll first explain why @s_ha_dum's answer doesn't work for me. I'm using Advanced Custom Fields to add the extra meta boxes, the ones I need to appear above the WordPress editor. @s_ha_dum pointed out that the WordPress editor is hardcoded within the template, but I noticed it can be disabled by removing support for the editor. ...


1

After some searching and working off of some pointers from toscho, and some other helpful posts to avoid an infinite loop I managed to figure out a solution. I'll post the code below then briefly explain: // Hook into the actions here public function __construct() { add_action( 'add_meta_boxes', array($this, 'meta_boxes' )); add_action( ...


1

There are a number of things going wrong in your code. I had to install it to see them all. First, You don't want global $post. save_post will pass the post ID. Add a parameter to your callback. function save_points($post_id){ update_post_meta($post_id, "category", $_POST["category"]); update_post_meta($post_id, "brand", $_POST["brand"]); ...


1

This is was I use to convert textarea with wp_editor() wp_editor($value, "editor-name", array( 'tinymce' => array( 'theme_advanced_buttons1' => 'bold,italic,underline', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => '' ) ));


1

Per the jQuery noConflict Wrappers section of the wp_enqueue_script() Codex page, the $ variable is not available in WordPress. You can replace $ with jQuery in your jQuery code, or do something like this: jQuery(document).ready(function($) { // your code here . . . });


1

You can download a copy of PHP Markdown and use it to parse the textarea contents before you save it: if ( ! class_exists( 'Markdown' ) ) { require_once( plugin_dir_path(__FILE__) . '/markdown.php' ); } $textarea_contents = Markdown::defaultTransform( $textarea_contents );


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

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

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

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

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 ...


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 ...



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