Wednesday, March 23, 2016

Wordpress- How to Create Custom Controls for the WordPress Theme Customizer

If we want to add textarea under Theme Customizer, we use the below code.

Put the below code in function.php

/*Customizer1 Code HERE*/
add_action('customize_register', 'theme_bannertext1_customizer' , 11);
function theme_bannertext1_customizer($wp_customize){
 //adding section in wordpress customizer  
    $wp_customize->add_section('banne1_settings_section', array(
      'title'          => 'Banner Text 1'
     ));
    //adding setting for footer text area
    $wp_customize->add_setting('banne1_settings_section', array(
     'default'        => 'Modern Axure template for Beautiful prototypes',
     ));
    $wp_customize->add_control('banne1_settings_section', array(
     'label'   => 'Banner Text1 Here',
      'section' => 'banne1_settings_section',
     'type'    => 'textarea',
    ));

 }

 /*Customizer2 Code HERE*/
add_action('customize_register', 'theme_bannertext2_customizer' , 12);
function theme_bannertext2_customizer($wp_customize){
 //adding section in wordpress customizer  
    $wp_customize->add_section('banne2_settings_section', array(
      'title'          => 'Banner Text 2'
     ));
    //adding setting for footer text area
    $wp_customize->add_setting('banne2_settings_section', array(
     'default'        => 'Modern Axure template for Beautiful prototypes',
     ));
    $wp_customize->add_control('banne2_settings_section', array(
     'label'   => 'Banner Text1 Here',
      'section' => 'banne2_settings_section',
     'type'    => 'textarea',
    ));

 }

No comments :

Post a Comment