1. December 2012
von Blackbam
As it is happens quite often that the rich editor of WordPress is a barrier concerning posts including difficult HTML, I wrote a Plugin. I am planning to release an improved version to the WordPress Plugin repository soon, but I think this works quite well for now:  
// Deactivate Visual Editor if option is set
add_action('pre_get_posts', 'deactivate_visual_editor');

function deactivate_visual_editor() {
  global $wp_rich_edit;
  $post_id = $_GET['post'];
  
  $value = get_post_meta($post_id, 'deactivate_visual_editor', true);
  if($value == 1)
    $wp_rich_edit = false;
}


// create a box for each post / page
function cis_init(){
	add_meta_box("cis_post_settings", __("Details",TEXTDOMAIN), "cis_post_settings", "page", "normal", "high");
	add_meta_box("cis_post_settings", __("Details",TEXTDOMAIN), "cis_post_settings", "post", "normal", "high");
}

function cis_post_settings() {
    global $post;
    $custom = get_post_custom($post->ID);
	
	// maybe we want to automatize this?
?>
	
checked="checked" />
post_type == "post" || $post->post_type == "page") { update_post_meta($post->ID, "deactivate_visual_editor", intval($_POST["deactivate_visual_editor"])); } }
Share

Dieser Eintrag wurde am 1. December 2012 um 21:21 in der Kategorie Plugins, WordPress, WP Scripts veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.


Tags: , , ,

Warning: Use of undefined constant Ext_related_links - assumed 'Ext_related_links' (this will throw an Error in a future version of PHP) in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75

No comments yet

Kommentare abonnieren (RSS) or URL Trackback

Leave a comment:

Warning: include_once(/home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache-premium/pro/library/lazy-load.php): failed to open stream: No such file or directory in /home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache/inc/cache.php on line 763 Warning: include_once(): Failed opening '/home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache-premium/pro/library/lazy-load.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache/inc/cache.php on line 763 Fatal error: Uncaught Error: Call to a member function lazy_load() on null in /home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache/inc/cache.php:766 Stack trace: #0 [internal function]: WpFastestCacheCreateCache->callback('...', 9) #1 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/functions.php(4469): ob_end_flush() #2 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/class-wp-hook.php(288): wp_ob_end_flush_all('') #3 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array) #4 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #5 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/load.php(947): do_action('shutdown') #6 [internal function]: shutdown_action_hook() #7 {main} thrown in /home/.sites/609/site1266/web/blackbams-blog/wp-content/plugins/wp-fastest-cache/inc/cache.php on line 766