Skip to content

Instantly share code, notes, and snippets.

@g33kidd
Created October 28, 2014 22:04
Show Gist options
  • Save g33kidd/d7ba7e184e7708ad787f to your computer and use it in GitHub Desktop.
Save g33kidd/d7ba7e184e7708ad787f to your computer and use it in GitHub Desktop.
Customizer Function
<?php
function extend_customizer() {
global $wp_customize;
// Add Panel
$wp_customize->add_panel('example', array(
'title' => 'Example Panel',
'description' => 'Description',
'priority' => 80
));
// Add Section
$wp_customize->add_section('example_section', array(
'title' => 'Section',
'description' => 'Description',
'priority' => 10,
'panel' => 'example' // optional
));
// Add Setting
$wp_customize->add_setting('example_setting', array(
'default' => 'Default Value',
'type' => 'theme_mod'
));
// Add Control
$wp_customize->add_control('example_control', array(
'label' => 'Example Control',
'description' => 'Description',
'settings' => 'example_setting',
'section' => 'example_section',
'type' => 'text'
));
// Add Custom Control
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'example_control',
array(
'label' => 'Example Control',
'description' => 'Description',
'settings' => 'example_setting',
'section' => 'example_section'
)
)
);
}
add_action('customize_register', 'extend_customizer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment