add_section( 'amp_section', array( 'title' => 'AMP', 'priority' => 1000, ) ); // ----------- amp enable ---------- $wp_customize->add_setting( 'amp_enable', array( 'default' => true, 'sanitize_callback' => 'sanitize_check', ) ); $wp_customize->add_control( 'amp_enable', array( 'settings' => 'amp_enable', 'label' => __( 'Enable AMP', THEME_NAME ), 'description' => '', 'section' => 'amp_section', 'type' => 'checkbox', 'priority' => 10, ) ); // ========== JSON-LD ========== $wp_customize->add_section( 'json_ld_section', array( 'title' => 'JSON-LD', 'priority' => 2000, ) ); // ---------- @type ---------- $wp_customize->add_setting( 'json_ld_type', array( 'default' => 'Article', 'sanitize_callback' => 'sanitize_text', ) ); $wp_customize->add_control( 'json_ld_type', array( 'settings' => 'json_ld_type', 'label' => __( '@type', THEME_NAME ), 'description' => 'http://schema.org/docs/full.html', 'section' => 'json_ld_section', 'type' => 'text', 'priority' => 10, ) ); // ---------- logo ---------- $wp_customize->add_setting( 'json_ld_logo_url', array( 'default' => '/images/logo.png', 'sanitize_callback' => 'sanitize_file_url', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'json_ld_logo_url', array( 'settings' => 'json_ld_logo_url', 'label' => __( 'Logo URL', THEME_NAME ), 'description' => 'size: 600x60', 'section' => 'json_ld_section', 'priority' => 20, ) ) ); // ---------- publisher ---------- $wp_customize->add_setting( 'json_ld_organization_name', array( 'default' => '', 'sanitize_callback' => 'sanitize_text', ) ); $wp_customize->add_control( 'json_ld_organization_name', array( 'settings' => 'json_ld_organization_name', 'label' => __( 'Organization name', THEME_NAME ), 'description' => '', 'section' => 'json_ld_section', 'type' => 'text', 'priority' => 30, ) ); } add_action( 'customize_register', 'theme_customize_register' ); // is amp enable function is_amp_enable(){ return get_theme_mod( 'amp_enable', false ); }