ID) ){ $thorium_header_image = esc_url( get_the_post_thumbnail_url( $post->ID, 'full' ) ); } else { $thorium_header_image = get_header_image(); } } ?> add_setting( $setting_id , array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'sanitize_text_field', 'transport' => $transport ) ); $wp_customize->add_control( $setting_id , array( 'type' => 'text', 'priority' => $priority, 'section' => $section_id, 'label' => $label, 'description' => $description, ) ); } function thorium_textarea_control( $setting_id, $section_id, $label = '', $default = '', $priority = 10, $transport = 'refresh', $description = '' ){ global $wp_customize; $wp_customize->add_setting( $setting_id , array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'sanitize_text_field', 'transport' => $transport ) ); $wp_customize->add_control( $setting_id , array( 'type' => 'textarea', 'priority' => $priority, 'section' => $section_id, 'label' => $label, 'description' => $description, ) ); } function thorium_color_control( $setting_id, $section_id, $label = '', $default = '', $priority = 10, $transport = 'refresh', $description = '' ){ global $wp_customize; $wp_customize->add_setting( $setting_id, array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'sanitize_hex_color', 'transport' => $transport ) ); $wp_customize->add_control( new WP_Customize_Color_Control ( $wp_customize, $setting_id, array( 'label' => $label, 'description' => $description, 'section' => $section_id, 'priority' => $priority, ) ) ); } if ( ! function_exists( 'thorium_checkbox_control' ) ) { /* * Check box controller * v1.0.0 */ function thorium_checkbox_control( $setting_id, $section_id, $label = '', $default = 0, $priority = 10, $transport = 'refresh', $description = '' ){ global $wp_customize; $wp_customize->add_setting( $setting_id, array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'thorium_sanitize_checkbox', 'transport' => $transport ) ); $wp_customize->add_control( $setting_id, array( 'type' => 'checkbox', 'priority' => $priority, 'section' => $section_id, 'label' => $label, 'description' => $description, ) ); } } if ( ! function_exists( 'thorium_link_control' ) ) { /* * Links controller * v1.0.0 */ function thorium_link_control( $setting_id, $section_id, $label = '', $description = '', $default = '', $priority = 10, $transport = 'refresh' ){ global $wp_customize; $wp_customize->add_setting( $setting_id, array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'esc_url_raw', 'transport' => $transport ) ); $wp_customize->add_control( $setting_id, array( 'type' => 'text', 'priority' => $priority, 'section' => $section_id, 'label' => $label, 'description' => $description, ) ); } } if ( ! function_exists( 'thorium_select_control' ) ) { /* * Select controller * v1.0.0 */ function thorium_select_control( $setting_id, $section_id, $choices, $label = '', $default = '', $priority = 10 ){ global $wp_customize; $wp_customize->add_setting( $setting_id, array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => $default, 'sanitize_callback' => 'thorium_sanitize_select', 'transport' => 'refresh' ) ); $wp_customize->add_control( $setting_id, array( 'type' => 'select', 'priority' => $priority, 'section' => $section_id, 'label' => $label, 'choices' => $choices ) ); } } /* * Sanitization */ if ( ! function_exists( 'thorium_sanitize_checkbox' ) ) { /** * Function to sanitize checkboxes * * @param $value * * @return int */ function thorium_sanitize_checkbox( $value ) { if ( $value == 1 ) { return 1; } else { return 0; } } } if ( ! function_exists( 'thorium_sanitize_select' ) ) { /** * Sanitize Select */ function thorium_sanitize_select( $input ) { if ( filter_var( $input, FILTER_SANITIZE_STRING ) ) { return $input; } } }