Advertisement
Guest User

WYSIWYG-editor - WpAlchemy

a guest
Oct 17th, 2011
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1.  
  2.  
  3.     // INCLUDE THE WP_ALCHEMY CLASS FOR EASIER METABOX CREATION ------------------------------------------
  4.    
  5.     // WPAlchemy makes for easier metaboxes
  6.     include_once 'metaboxes/setup.php';
  7.     include_once 'metaboxes/metaboxes.php';
  8.      
  9.     // include_once 'metaboxes/demo-filer/full-spec.php';
  10.    
  11.     // include_once 'metaboxes/demo-filer/checkbox-spec.php';
  12.    
  13.     // include_once 'metaboxes/demo-filer/radio-spec.php';
  14.    
  15.     // include_once 'metaboxes/demo-filer/select-spec.php';
  16.  
  17.  
  18.     // Add support for WYSIWYG in WPAlchemy. Wrap textboxes in a div with the class of "customEditor" to use it.
  19.     add_action('admin_print_footer_scripts','my_admin_print_footer_scripts',99);
  20.     function my_admin_print_footer_scripts()
  21.     {
  22.         ?><script type="text/javascript">/* <![CDATA[ */
  23.             jQuery(function($)
  24.             {
  25.                 var i=1;
  26.                 $('.customEditor textarea').each(function(e)
  27.                 {
  28.                     var id = $(this).attr('id');
  29.      
  30.                     if (!id)
  31.                     {
  32.                         id = 'customEditor-' + i++;
  33.                         $(this).attr('id',id);
  34.                     }
  35.      
  36.                     tinyMCE.execCommand('mceAddControl', false, id);
  37.      
  38.                 });
  39.             });
  40.         /* ]]> */
  41.        
  42.         </script><?php
  43.     }
  44.    
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement