Created
October 28, 2014 22:04
-
-
Save g33kidd/d7ba7e184e7708ad787f to your computer and use it in GitHub Desktop.
Customizer Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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