Updating post content on the front end
You should use the wp_update_post function.
Git this to work by using the following line of code in my theme’s functions.php. $wordcount = str_word_count( strip_tags( $content ), 0 ); I got this piece of code from a stackoverflow post. The only disadvantage with this code is that it does not update dynamically which is not a big issue as the current … Read more
The “bold” icon on the visual editor is represented by a <span> with the class of mce_bold. You can target it using jQuery pretty easily and add a tooltip: jQuery(‘.mce_bold’).attr(‘title’, ‘Please use an H2 tag instead.’); If you want to target it inside the HTML editor as well, use this code instead: jQuery(‘.mce_bold, #qt_content_strong’).attr(‘title’, ‘Please … Read more
Unfortunately you can’t yet… see this trac ticket: http://core.trac.wordpress.org/ticket/19173 In particular it seems that: The problem is that TinyMCE, once initialized cannot be moved in the DOM, or rather the browsers cannot handle it being moved. That’s why the errors are so inconsistent in different browsers. Moving the postbox triggers this. Some browsers/versions handle that … Read more
I have found a great post which solves this issue, http://wordpress.org/support/topic/plugin-qtranslate-problems-displaying-in-the-edit?replies=21#post-3160564 The issue is on qtranslate_javascript.php line 225 Replace var waitForTinyMCE = window.setInterval(function() { if(typeof(tinyMCE) !== ‘undefined’ && typeof(tinyMCE.get2) == ‘function’ && tinyMCE.get2(‘content’)!=undefined) { content=jQuery(‘#content’).val(); tinyMCE.get2(‘content’).remove(); jQuery(‘#content’).val(content); window.clearInterval(waitForTinyMCE); } }, 250); WITH: Only change the 250 to 500 🙂 this should solve the problem… var … Read more
You should use the wp_update_post function.
Filter gettext_with_context and change the name here: <?php # -*- coding: utf-8 -*- /* Plugin Name: Rename ‘Text’ editor to ‘HTML’ */ add_filter( ‘gettext_with_context’, ‘change_editor_name_to_html’, 10, 4 ); function change_editor_name_to_html( $translated, $text, $context, $domain ) { if ( ‘default’ !== $domain ) return $translated; if ( ‘Text’ !== $text ) return $translated; if ( ‘Name … Read more
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 );
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 should override the editor.css. Let me … Read more
The Problem This turned out to be a common case of needing to use stripslashes();. How did I figure this out? I logged into phpMyAdmin, navigated to the options table, found my option name, and edited it. Here’s what I discovered… s:11:”description”;s:90:”<span style=\”text-decoration: underline;\”>This is supposed to be underlined text.</span>”; So obviously my plugin is … Read more
Without seeing your code I can’t say whats wrong but here is a working (tested) example of a metabox with an editor inside that has the visual/text tabs. add_action( ‘add_meta_boxes’, function() { add_meta_box(‘html_myid_61_section’, ‘Meta Box Title’, ‘my_custom_meta_function’); }); function my_custom_meta_function( $post ) { $text= get_post_meta($post, ‘my_custom_meta’ , true ); wp_editor( htmlspecialchars_decode($text), ‘mettaabox_ID’, $settings = array(‘textarea_name’=>’inputName’) … Read more