Advertisement
FireBot

wp_customizer-wp_editor-notsaving

Jul 29th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. function Formation_customizer_child($wp_customize) {
  2.     //Add the texteditor option for wp_customize
  3.     class Customize_Text_Editor_Control extends WP_Customize_Control {
  4.         public function render_content() {
  5.         ?>
  6.             <span class="customize-control-title"><?php echo esc_html($this->label); ?></span>
  7.             <?php
  8.             $settings = array(
  9.                 'textarea_name' => $this->id,
  10.                 'media_buttons' => false,
  11.                 'teeny'         => true
  12.                 );
  13.             wp_editor($this->value(), $this->id, $settings);
  14.         }
  15.     }
  16.    
  17.     $wp_customize->add_section('featured_section_top_child', array(
  18.         'title'       => __('Featured Text Area', 'Formation'),
  19.         'description' => __('This is a settings section to change the homepage featured text area.', 'Formation'),
  20.         'priority'    => 195
  21.         )
  22.     );
  23.    
  24.     $wp_customize->add_setting(
  25.     'featured_texteditor', array(
  26.         'default' => '',
  27.         )
  28.     );
  29.  
  30.     $wp_customize->add_control( new Customize_Text_Editor_Control( $wp_customize,
  31.         'featured_texteditor', array(
  32.         'label'    => __('Featured Text Header', 'Formation'),
  33.         'section'  => 'featured_section_top_child',
  34.         'settings' => 'featured_texteditor',
  35.         )
  36.     ));
  37.  
  38.     $wp_customize->add_setting('featured_button_url_child');
  39.    
  40.     $wp_customize->add_control(
  41.         'featured_button_url_child', array(
  42.         'label'   => __('Featured Button URL', 'Formation'),
  43.         'section' => 'featured_section_top_child',
  44.         'type'    => 'text',
  45.         )
  46.     );
  47. }
  48. add_action('customize_register', 'Formation_customizer_child');
  49.  
  50. //Remove parent theme featured text box
  51. function run_after_setup(){
  52.     remove_action('customize_register', 'Formation_customizer');
  53. }
  54. add_action('after_setup_theme', 'run_after_setup');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement