2. Theme Customization API
function bwpy_customizer( $wp_customize ) {
// customizer build code
}
add_action( 'customize_register', 'bwpy_customizer' );
The WordPress Theme Customization API is a way to build
customization options directly into your theme or plugin
without having to build custom options through the Settings API.
4. Theme Customization API
$wp_customize->add_setting( 'bwpy_page_comment_toggle', array(
'default' => 1
) );
Part 2 – Customizer Setting
Customizer settings are what really let you hack into WordPress
with minimal effort. Creating theme options is not just about
HTML forms.
The information passed through those forms need to save, be
accessible, etc.That’s what customizer settings do for you.
5. Theme Customization API
$wp_customize->add_control( 'bwpy_page_comment_toggle', array(
'label' => __( 'Show comments on pages?', 'bwpy' ),
'section' => 'bwpy_content_options_section',
'type' => 'checkbox',
'priority' => 10
) );
Part 3 – Customizer Control
This is the final step in creating an option and where things get
the most detailed. Here you determine what kind of option to
create, what its label will be, and what section it will fall under,
among other things.