[wp-hackers] WordPress Front-End tinyMCE
Frank Bueltge
frank at bueltge.de
Thu Jul 7 16:37:33 UTC 2011
Hi all,
current it is possible to include the editor via the_editor()
function, also an different scripts and works. But it is not possible
to add this function clear to meta boxes for posts or other
post_types, if has an editor. The problem is the javascript; the
editor buttons of the editor for switch html/visual has fixed IDs and
the script use this, thats is a great problem and if you switch on a
editor, also the other editor switch and the active button is not
correct.
you see this in editor.dev.js
var ed, qt = this.I('quicktags'), H = this.I('edButtonHTML'), P =
this.I('edButtonPreview'), ta = this.I(id);
if you will include the editor on a othe rpage, include css and
javascript (fast code on mail !!):
add_filter( 'admin_head', 'example_tmce' );
function example_tmce() {
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_print_scripts('editor');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_enqueue_script('utils');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
}
$value = $this -> load_post_meta( $data->ID );
$id = 'fb_example_tmce';
the_editor($value['example_content'], $id, $prev_id = 'title',
$media_buttons = true, $tab_index = 4, $extended = true);
Best regards
On Thu, Jul 7, 2011 at 6:23 PM, Scott Kingsley Clark <scott at skcdev.com> wrote:
>> Has anyone tackled this problem before?
>
> Actually, I've got just the thing!
>
> http://plugins.trac.wordpress.org/browser/pods/trunk/ui/wp-editor
>
> Andrew Ozz developed this as the new API for TinyMCE which allows for
> front / back end forms and much more functionality beyond the current
> mess (you already know what I'm talking about). Goodbye the_editor,
> hello wp_editor!
>
> We modified the CSS location in the script, so you'll want to pop it
> out and update the location to wherever you end up putting it.
>
> To use use the editor, you can do this:
>
> <textarea name="whatever" id="whatever" class="whatever"><?php echo
> esc_html($content); ?></textarea>
> <?php
> global $wp_editor;
> $media_bar = false; // set to true to show the media bar
> echo $wp_editor->editor($content, 'whatever', $media_bar);
> ?>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list