Advertisement
Guest User

Untitled

a guest
Aug 20th, 2015
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. // para renderizar o editor:
  2. function apresentacao_texto_setting() {
  3.         $options = get_option('p_apresentacao');
  4.         wp_editor( get_post_meta(
  5.                 $options['apresentacao_texto'],
  6.                 'apresentacaotexto',
  7.                 true
  8.         ),
  9.         'apresentacaotexto', // editor id
  10.         $settings = array(
  11.                 'wpautop' => false,
  12.                 'media_buttons' => false,
  13.                 'editor_height' => 150,
  14.                 'teeny' => true
  15.         )
  16. );
  17. }
  18.  
  19.  
  20. // depois, para tentar salvar no banco de dados:
  21. function proserv_save_custom_fields() {
  22.     global $_POST;
  23.     $postid = (wp_is_post_revision( $postid )) ? wp_is_post_revision ( $post ) : $postid;
  24.     $post_type = get_post_type( $postid );
  25.     if ('textoapresentacao' == $post_type) {
  26.         update_post_meta($postid, 'apresentacaotexto', $_POST['apresentacaotexto']);
  27.     }
  28. }
  29. add_action('save_post', 'proserv_save_custom_fields', 1, 2);
  30. function admin_init(){
  31.   add_meta_box("p_apresentacao_texto", "Texto Apresentacao", "apresentacao_meta_options", 'textoapresentacao', "normal", "low");
  32. }
  33. add_action('admin_init', 'admin_init');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement