Customizer Setting

Core controls include ‘text’, ‘checkbox’, ‘textarea’, ‘radio’, ‘select’, and ‘dropdown-pages’. Additional input types such as ’email’, ‘url’, ‘number’, ‘hidden’, and ‘date’ are supported implicitly. Default ‘text’.

See Customizer Objects and WP_Customize_Control for more information.

<?php /** * Customizer * * @package ClientName * @author Bill Erickson * @since 1.0.0 * @license GPL-2.0+ **/ class EA_Customizer { public function __construct() { add_action( 'customize_register', array( $this, 'customize_register' ) ); } /** * Register customizer setting * */ function customize_register( $wp_customize ) { $wp_customize->add_section( 'ea_theme_settings', array( 'title' => __( 'Theme Settings', 'ea' ) )); $wp_customize->add_setting( 'ea_single_video_ad' ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ea_single_video_ad', array( 'label' => __('Show Video Ad', 'ea'), 'section' => 'ea_theme_settings', 'settings' => 'ea_single_video_ad', 'type' => 'checkbox', ) ) ); } } new EA_Customizer();
Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk