Tag Info

Hot answers tagged

9

The follow small plugin create a custom buttom inside line 1 of the WordPress TinyMCE Version 4, tested in WP Version 3.9-beta2. The plugin have var_dump include to understand the values. It also possible to add the button to other lines of the visual editor, only a other hook, like for line 2: mce_buttons_2. Result Plugin, php side - tinymce4-test.php ...


8

What happens is that TinyMCE converts every double line break in the HTML source to <p></p> and vice versa. It will actually strip away any <p/> you manually enter in the HTML source after you save, because when the post's content is rendered, <p> and </p> will be added. The auto-<p> replacement only works when you're ...


7

Just wrote the function. It'll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy. /** * Display advanced TinyMCE editor in taxonomy page */ function wpse_7156_enqueue_category() { global $pagenow, $current_screen; if( $pagenow == 'edit-tags.php' ) { ...


6

Here is a nice and fairly new (a year old) tutorial i've read a few days ago http://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/ He as a great example and you cal also download the source files and get a better understanding.


5

The best way to do this is by adding 'user_can_richedit' filter, like so: add_filter( 'user_can_richedit', 'patrick_user_can_richedit'); function patrick_user_can_richedit($c) { global $post_type; if ('page' == $post_type) return false; return $c; } Hope it's useful ;)


5

There is a hook for that: 'mce_css'. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter. Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as a ...


5

Best solution for what you want to accomplish which is essentially to make the next page feature more user friendly for your authors is to add a TinyMCE button that will do this for you. This may be a bit complicated so hold your hat. To avoid this answer being the length of a thesis, I have added comments in all codes to help you understand what each ...


4

I cannot offer a JavaScript solution, because I am not sure where exactly this is happening. But … we can hook into wp_insert_post_data and solve this issue in PHP: add_filter( 'wp_insert_post_data', 't5_strip_double_spaces', 20 ); function t5_strip_double_spaces( $data ) { $data['post_content'] = preg_replace( "~( \x{C2}\x{A0}|\x{C2}\x{A0} ...


4

The meta box order gets stored in the user meta and is basically an array of "priority" and meta box id. I didn't check if this meta key gets generated upon user setup or when the first manual reordering occurs. To see how this array looks, and how the native WP metaboxes IDs on a page (post, cpt) are, you can var_dump the following: ...


4

add_action('init', 'remove_editor_init'); function remove_editor_init() { // if post not set, just return // fix when post not set, throws PHP's undefined index warning if (isset($_GET['post'])) { $post_id = $_GET['post']; } else if (isset($_POST['post_ID'])) { $post_id = $_POST['post_ID']; } else { return; } ...


4

For posts: add_action('init', 'my_custom_init'); function my_custom_init() { remove_post_type_support( 'post', 'editor' ); } See Codex. For custom post types that you register, you can specify what 'features' it supports when you register it it use the 'supports' arguments. For custom post types that are not registered by you can use the above with ...


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 WYSIWYG uses the .wp-editor-container class. So the easiest way would be to change this in your css. If your style is being over written then just add !important. .wp-editor-container { width:50%; // What ever size you want } the wp_editor function also allows us to pass a class to the not sure if this might help you. Here's how tho: <?php ...


3

In your code, calling the action admin_init makes is_admin() unnecessary. And, if not mistaken, is_page() is meant to be used in the front-end... But the solution is the following (based on this Answer): add_filter( 'user_can_richedit', 'wpse_58501_page_can_richedit' ); function wpse_58501_page_can_richedit( $can ) { global $post; if ( 28 == ...


3

The first issue is that add_editor_style() is usually called in Theme setup functions that get hooked into after_setup_theme - which is well before the query is set up and the post type determined. So, you'll need to move add_editor_style() to a separate callback, that gets called after the query is setup, but before TinyMCE is initialized. Perhaps ...


3

Add to function.php add_filter('tiny_mce_before_init', 'tiny_mce_before_init'); And function tiny_mce_before_init: function tiny_mce_before_init($init) { $init['setup'] = "function(ed) { ed.onBeforeSetContent.add(function(ed, o) { if ( o.content.indexOf('<pre') != -1) { o.content = ...


3

There is an add_meta_boxes function that fires that you can hook into - it fires whenever the edit post page is rendered. At that point, you can get the ID of the post being edited using get_the_ID(). You can then compare it to the ID for which you want to remove the post editor: function remove_pages_editor(){ if(get_the_ID() == 23) { ...


3

I have not a working solution at hand, but what I would do is to analyze how this is done for the more seperator. In the HTML editor, there is <!-- more -->, in the visual editor, an image is displayed instead. This is done by extending the tinyMCE editor - which is the base of the visual editor in wordpress - with a plugin. To learn more about ...


3

http://www.laptoptips.ca/projects/category-description-editor/ this works very good. about adding another field, I'v tried @MikeSchinkel solution here Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin? and it works very good also.


3

There seem to be a few people scratching this itch over at the TinyMCE sourceforge tracker. http://sourceforge.net/tracker/?group_id=103281&atid=738747 This looks promising.. "CodeExtras adds <var> and <code> markup buttons - ID: 2904557" http://sourceforge.net/tracker/?func=detail&aid=2904557&group_id=103281&atid=738747


3

It seems TinyMCE provides no easy setting to select a default value. But there is another backdoor: the external_link_list_url option of TinyMCE can point to an extra Javascript file that will be loaded in the link editor window. You can use it to populate a dropdown of frequent link destinations, but since it is a regular Javascript file we can also drop ...


3

when one of my clients have doesn't like the TinyMCE editor i add the Dean's FCKEditor For WordPress plugin that integrates the ckeditor and install the office 2003 skin for it so they find it easier to use.


3

add_action('init', 'remove_editor_init'); function remove_editor_init() { remove_post_type_support('page', 'editor'); } You can wrap this inside your existing logic for detecting the current page template, so you only disable the editor for specific pages. See: http://codex.wordpress.org/Function_Reference/remove_post_type_support


3

Use the filter tiny_mce_before_init to customise the default configuration; function __my_tiny_mce( $config ) { $config['theme_advanced_path'] = false; return $config; } add_filter('tiny_mce_before_init', '__my_tiny_mce'); Check out all the options available on the Tiny MCE documentation.


3

The answer is rather simple – you type them. :) When properly configured WP should be able to support Unicode characters for ⌘ and ⌥. Even when not you can fall back to numeric character references (&#8984; and &#8997; respectively). Windows key has no Unicode symbol and is typically abbreviated as Win. <kbd> HTML element is ...


2

the editor uses its own stylesheet which might be quite different from the one on your theme. If you are willing to dig into the code it would make sense to make a stylesheet for the editor. See this for details http://codex.wordpress.org/Function_Reference/add_editor_style


2

That may be a bit problematic. I use the plugin SyntaxHighlighter Evolved, but as the plugin description says (my emphasis): TIP: Don't use the Visual editor if you don't want your code mangled. TinyMCE will "clean up" your HTML. Another option is to embed Gists (or similar) using a Shortcode to pass the URL and let PHP render the script tag (as ...


2

I'm currently having the same problem. Here's my work-around. add_filter( 'tiny_mce_before_init', 'workaround' ); public function workaround( $in ) { $in['force_br_newlines'] = true; $in['force_p_newlines'] = false; $in['forced_root_block'] = ''; return $in; } tiny_mce_before_init gives you access to the TinyMCE settings that WordPress' ...



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