<?php
/*
Create theme option customizer
Using customize register API
** section_id_show_test : Id Of section
** af_text_1 : Id of input
*/
function ghled_customize_register($wp_customize){
//This adds a new setting to the database.
$wp_customize->add_section('section_id_show_test', array(
'title' => __('Inputs for test', 'textdomaine'),
'description' => '',
'priority' => 120,
));
//This adds a new section (i.e. category/group) to the Theme Customizer page.
// =============================
// = Text Input =
// =============================
$wp_customize->add_setting('af_text_1', array(
'default' => 'value_xyz',
'capability' => 'edit_theme_options',
'type' => 'option',
));
//This creates an HTML control that admins can use to change settings. This is also where you choose a section for the control to appear in.
$wp_customize->add_control('id_controle_text_1', array(
'label' => __('Text Test', 'textdomaine'),
'section' => 'section_id_show_test',
'settings' => 'af_text_1',
));
}
//Hooking function
add_action('customize_register', 'ghled_customize_register');
/*
Retrieving by : get_option(;
*/
//get_option('af_text_1');
$str1 = get_option('af_text_1');
var_dump($str1);