Tag Info

Hot answers tagged

24

here's what we did yesterday on a client site that we were having this exact problem with... I created a quick filter as a plugin and activated it. <?php /* Plugin Name: Image P tag remover Description: Plugin to remove p tags from around images in content outputting, after WP autop filter has added them. (oh the irony) Version: 1.0 Author: Fublo Ltd ...


17

You can customized the filter of the tinymce, see the follow example for iframes and other tags to use Google Maps inside the TinyMCE. function fb_change_mce_options($initArray) { // Comma separated string od extendes tags // Command separated string of extended elements $ext = ...


15

First: Big Thanks to @Thomas McDonald for his answer; I needed to figure out exactly the same question that @Paul Sheldrake asked and Thomas' code got me started in the right direction. Unfortunately I then got stuck because I needed to change the layout from the default to a simpler and smaller layout since I needed to use the TinyMCE in a side metabox. I ...


13

Say your custom post type was called Properties, you would add the box to hold your additional tinyMCE editor using code similar to this: function register_meta_boxen() { add_meta_box("wysiwyg-editor-2", "Second Column", "second_column_box", "properties", "normal", "high"); } add_action('admin_menu', 'register_meta_boxen'); wysiwyg-editor-2 is ...


11

Basically you need to make WordPress treat img like block-level element for the purpose of formatting. Such elements are hardcoded in wpautop() and list is unfortunately not filtered. What I would do is: Fork wpautop() under different name. Add img to regexp in $allblocks variable. Remove wpautop from the_content filter. Add your forked version to ...


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

If you don't want to write your own code there is a plugin to allow embedding an <iframe>: Embed IFrame Plugin for WordPress Then just use the shortcode like this: [iframe http://example.com 400 500]


6

WP runs so many prettifying filters on this stuff that it's easy to get lost. Here is what I ended up with: remove_filter('comment_text', 'make_clickable', 9); add_filter('pre_comment_content', 'strip_comment_links'); function strip_comment_links($content) { global $allowedtags; $tags = $allowedtags; unset($tags['a']); $content = ...


5

I'd suggest using editor style for your wysiwyg. Add add_editor_style(); to your functions.php and then add a new file called editor-style.css to your main theme directory. Your editor style should reflect the basic css settings like your actual frontend content width, H1, H2, p etc tags styles, margins, image padding adn margins etc. Don't copy your default ...


5

Use this class: http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html and then call the metabox like this (don't forget to read the manual and view some examples): $meta_boxes[] = array( 'id' => 'textmetabox', 'title' => 'Your Meta Box Title', 'pages' => array('post', 'slider', 'whatever-your-cpt-is'), 'fields' => ...


5

Pre WP 3.3: http://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/ If you are using WP 3.3 or later you might look up wp_editor: http://codex.wordpress.org/Function_Reference/wp_editor $settings = array( 'teeny' => true, 'textarea_rows' => 15, 'tabindex' => 1 ); wp_editor(esc_html( ...


4

I've never found one that was reliable and/or not a huge resource/memory drain. :( I ended up using the very handy "Page in Widget" plugin instead - it has the advantage of all the functionality of a regular editable page and your widget content won't accidentally get wiped, which has happened to me far too often. Sorry not to have the perfect solution. ...


4

You can add an editor-style.css stylesheet in your theme which mimics the look-and-feel of your blog. Here are some tips on how to do that (you'll need to touch functions.php too): http://www.deluxeblogtips.com/2010/05/editor-style-wordpress-30.html The first two styles in that example are the important ones; usually what I do is just copy over and rename ...


4

I tried for a bit and could not get this to work perfectly, but it's close, it's hard to extend with the <form> for the popup styles being hardcoded, thought possible with more work. To get started you can: Enqueue the link popup javascript and styles, the main .js file is wp-includes/wplink.js. Depending on where you loading this you might need to ...


4

I'd suggest using Ozh's TinyMCE Advanced plugin. It lets you add a 'Paste from Word' option that takes care of all of that for you. However, if you're not interested in that, you have a few more options. Like this: function get_rid_of_mso_junk( $content ){ return preg_replace( '@(mso|panose)[^:]{1,25}:[^;]+;(\s+)?(\n+)?@i', '', $content ); } add_filter( ...


4

If you still want to use SO-type backtick markup for styling your inline code examples, I've created some code that will accomplish it. To make it into your own plug-in, just add the code below to your functions.php. It calls the wordpress filter "the_content" to apply the transformation to the content when it is displayed, thereby keeping any ...


3

This is because the images are defined as floating to the left. To solve this, you can add a clear: both to the <h4> elements (it probably won't hurt to do this in the stylesheet - will there be a situation where you need a title that exists next to a float?).


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

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

It turns out that TinyMCE has it's own autop setting, so if you kill it before the sort and then put it back you should be good to go! Check out the autop setting handling in this snippet: <script> (function($) { // by default, wpautop will be true var wpautop = true; // this function wraps subsequent additions of TinyMCE ...


3

To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they're all on. If you get them all back on and the content still shows, you know the problem is somewhere in your theme. ...


3

I am aware of the capability of adding meta boxes for single text fields, etc, but that's not what I am actually after. Meta fields aren't just for "single text fields", the database type is longtext: mysql> DESCRIBE wp_postmeta; +------------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | ...


3

Alternatively, you can handle post-editor support directly in your register_post_type() call, via the 'supports' parameter in the $args array. The default value is: 'supports' => array( 'title', 'editor' ). You can change it to whatever you need; for example: 'supports' => array( 'title' ).


2

Re: this comment: I am using Custom Types UI in combo with AdvancedCustomFields. The Custom Post Types UI Plugin exposes all of the register_post_type() $args array parameters in its UI. In this case, you simply need to find the Supports section, and disable/uncheck Editor:


2

Text its just plain text, just as its saved in your db. Wordpress changes line breaks with paragraphs with the function wpautop, through the filter the_content and the_excerpt. If you need to remove the wpautop behavior, you can remove the filter by doing this in your theme's functions.php: remove_filter( 'the_content', 'wpautop' ); remove_filter( ...


2

There is a way to put that meta box after the title. There is a hook called edit_form_after_title. If you look at the source there is no hook earlier than that that isn't much too early-- outside of the <form tag. The following does move that box to the location after the title... function generic_box() { remove_meta_box('postcustom',null,'core'); ...


2

You shouldn't call add_editor_style() directly in your functions.php file. Instead, you should wait until the plugins and themes have been loaded: add_action( 'after_setup_theme', 'add_editor_style' ); If you already have a function hooked to after_setup_theme, you can call add_editor_style() inside there instead. You then need create a file called ...


2

I imagine you're also adding a filter mce_buttons to add in the button to, something like.. add_filter( 'mce_buttons', 'add_my_tinymce_buttons' ); function add_my_tinymce_buttons( $items ) { $items[] = 'your-button'; return $items; } Just change the filter to hook onto mce_buttons_2 instead, and the button will appear on the second row , eg.. ...



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