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', 'ampbase' ), 'description' => '', 'section' => 'amp_section', 'type' => 'checkbox', 'priority' => 10, ) ); // ---------- Amp Tracking ID ---------- $wp_customize->add_setting( 'amp_tracking_id', array( 'default' => '', 'sanitize_callback' => 'sanitize_text', ) ); $wp_customize->add_control( 'amp_tracking_id', array( 'settings' => 'amp_tracking_id', 'label' => __( 'AMP Tracking ID', 'ampbase' ), 'description' => __( 'Set if you want to separate AMP tracking.', 'ampbase' ), 'section' => 'amp_section', 'type' => 'text', 'priority' => 10, ) ); // ---------- Category ID not generating AMP page ---------- $wp_customize->add_setting( 'noamp_category_ids', array( 'default' => '', 'sanitize_callback' => 'sanitize_id_comma_text', ) ); $wp_customize->add_control( 'noamp_category_ids', array( 'settings' => 'noamp_category_ids', 'label' => __( 'Categories to exclude from AMP', 'ampbase' ), 'description' => __( 'Example: 1,7,2', 'ampbase' ), 'section' => 'amp_section', 'type' => 'text', 'priority'=> 60, ) ); // ==================== 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', 'ampbase' ), 'description' => 'See -> 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', 'ampbase' ), 'description' => 'size: 600x60', 'section' => 'json_ld_section', 'priority' => 20, ) ) ); // ---------- Publisher ---------- $wp_customize->add_setting( 'json_ld_organization_name', array( 'default' => '', 'sanitize_callback' => 'smpbase\anitize_text', ) ); $wp_customize->add_control( 'json_ld_organization_name', array( 'settings' => 'json_ld_organization_name', 'label' => __( 'Organization name', 'ampbase' ), 'description' => '', 'section' => 'json_ld_section', 'type' => 'text', 'priority' => 30, ) ); // ==================== Analytics ==================== $wp_customize->add_section( 'analytics_section', array( 'title' => 'Analytics', 'priority' => 3000, ) ); $wp_customize->add_setting( 'tracking_id', array( 'default' => '', 'sanitize_callback' => 'sanitize_text', ) ); $wp_customize->add_control( 'tracking_id', array( 'settings' => 'tracking_id', 'label' => __( 'Tracking ID', 'ampbase' ), 'description' => '', 'section' => 'analytics_section', 'type' => 'text', 'priority' => 10, ) ); // ==================== SVG Header Image ==================== $wp_customize->add_section( 'svg_header_image', array( 'title' => 'SVG Header Image', 'priority' => 4000, ) ); // ---------- Logo ---------- $wp_customize->add_setting( 'svg_header_image', array( 'default' => '/images/no-svg-header.svg', 'sanitize_callback' => 'sanitize_file_url', ) ); $wp_customize->add_control( new \WP_Customize_Image_Control( $wp_customize, 'svg_header_image', array( 'settings' => 'svg_header_image', 'label' => __( 'SVG Header Image URL', 'ampbase' ), 'description' => 'size: recommend 320x50', 'section' => 'svg_header_image', 'priority' => 10, ) ) ); } add_action( 'customize_register', 'ampbase_customize_register' ); // is amp enable function ampbase_is_amp_enable(){ return get_theme_mod( 'amp_enable', false ); }