sinanisler logo

Customizer Register WordPress Theme Setting Simple

Very simple example…



function sinan_customizer_register($wp_customize){

    $wp_customize->add_section( 'section_name', array(
        'title' => 'Text Title',
        'description' => 'Text descripotion sometin hee'
    ) );

    $wp_customize->add_setting( 'setting_name', array(
        'type' => 'theme_mod',
        'default' => 'default text here',
        'sanitize_callback' => 'esc_attr'
    ) );

    $wp_customize->add_control( 'control_name', array(
        'label' => 'Text Label ',
        'description' => 'Text descripotion sometin hee',
        'section' => 'section_name',
        'settings' => 'setting_name',
        'type' => 'text'
    ) );


add_action( 'customize_register', 'sinan_customizer_register' );


and this is how you get your setting pick one;


echo get_theme_mod('setting_name');

$var = get_theme_mod('setting_name');



For more info check this:

and this:


and Check this out to understand layout


Leave the first comment