Créer la fonction
function starter_theme_customizer($wp_customize) {}
add_action('customize_register', 'starter_theme_customizer');
Ajouter une section
// Réseaux sociaux
$wp_customize->add_section('starter_theme_rs', array(
'title' => 'Réseaux sociaux',
'priority' => 11,
));
Ajouter un paramètre
// Réseaux sociaux - Facebook
$wp_customize->add_setting('starter_theme_rs_facebook');
$wp_customize->add_control( 'starter_theme_rs_facebook', array(
'label' => 'Facebook',
'section' => 'starter_theme_rs',
'settings' => 'starter_theme_rs_facebook'
) ) ;
Color picker
$wp_customize->add_setting( 'diwp_header_bgcolor', array(
'default' => '#45ace0',
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'diwp_theme_color', array(
'label' => 'Theme Color',
'section' => 'colors',
'settings' => 'diwp_theme_color'
)));
Appeler une variable dans le template
<?php echo get_theme_mod( 'starter_theme_rs_facebook' ); ?>
Julien
.badge{
background-color: #ddd;
text-decoration: none;
text-transform: uppercase;
font-size: 12px;
letter-spacing: 1px;
font-weight: 800;
line-height: 24px;
padding: 0 10px;
border-radius: 12px;
color: #3f51b5;
span{
color: #fff;
padding: 0 3px;
border-radius: 8px;
min-width: 16px;
display: inline-block;
height: 16px;
line-height: 16px;
vertical-align: middle;
}
}