' . esc_html( $this->label ) . ''; // Displays category checkboxes. foreach ( get_categories() as $category ) { echo '
'; } // Loads the hidden input field that stores the saved category list. ?>link(); ?> value="value() ); ?>">add_setting( 'travel_notes_color_settings', array ( 'default' => '#24cb83', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'travel_notes_color_settings', array( 'label' => __( 'Theme Accent Color 1', 'travel-notes' ), 'section' => 'colors', 'settings' => 'travel_notes_color_settings', ) ) ); $wp_customize->add_setting( 'travel_notes_color_settings_2', array ( 'default' => '#292929', 'sanitize_callback' => 'sanitize_hex_color', ) ); /* author bio in posts option */ $wp_customize->add_section( 'travel_notes_posts_section' , array( 'title' => __( 'Post Settings', 'travel-notes' ), 'priority' => 35, 'description' => __( '', 'travel-notes' ), ) ); $wp_customize->add_setting( 'travel_notes_related_posts', array ( 'sanitize_callback' => 'travel_notes_sanitize_checkbox', ) ); $wp_customize->add_control('related_posts', array( 'settings' => 'travel_notes_related_posts', 'label' => __('Disable the Related Posts?', 'travel-notes'), 'section' => 'travel_notes_posts_section', 'type' => 'checkbox', )); $wp_customize->add_setting( 'travel_notes_author_area', array ( 'sanitize_callback' => 'travel_notes_sanitize_checkbox', ) ); $wp_customize->add_control('author_info', array( 'settings' => 'travel_notes_author_area', 'label' => __('Disable the Author Information?', 'travel-notes'), 'section' => 'travel_notes_posts_section', 'type' => 'checkbox', )); $wp_customize->add_section( 'travel_notes_home_feature' , array( 'title' => __( 'Home page features', 'travel-notes' ), 'priority' => 28, ) ); $wp_customize->add_setting( 'travel_notes_youtube_vid', array ( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_youtube_vid', array( 'label' => __( 'Banner Video (Youtube Video ID)', 'travel-notes' ), 'section' => 'travel_notes_home_feature', 'settings' => 'travel_notes_youtube_vid', 'priority' => 100, ) ) ); $wp_customize->add_setting( 'travel_notes_featured_select', array( 'default' => __('sticky','travel-notes'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'travel_notes_select' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_featured_select', array( 'settings' => 'travel_notes_featured_select', 'label' => __( 'Choose whether to display "Sticky Posts" or "Categories" or nothing', 'travel-notes' ), 'section' => 'travel_notes_home_feature', 'type' => 'select', 'priority' => 101, 'choices' => array( 'none' => __( 'None', 'travel-notes' ), 'sticky' => __( 'Sticky Posts', 'travel-notes' ), 'category' => __( 'Categories', 'travel-notes' ), ) ))); $wp_customize->add_setting( 'travel_notes_custom_categories', array( 'default' => __('','travel-notes'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( new travel_notes_Category_Checkboxes_Control( $wp_customize, 'travel_notes_custom_categories', array( 'label' => 'Select Categories', 'section' => 'travel_notes_home_feature', 'settings' => 'travel_notes_custom_categories', 'priority' => 102 ) ) ); /* social media option */ $wp_customize->add_section( 'travel_notes_social_section' , array( 'title' => __( 'Social Media Icons', 'travel-notes' ), 'priority' => 31, 'description' => __( 'Optional media icons in the header', 'travel-notes' ), ) ); $wp_customize->add_setting( 'travel_notes_facebook', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_facebook', array( 'label' => __( 'Enter your Facebook url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_facebook', 'priority' => 101, ) ) ); $wp_customize->add_setting( 'travel_notes_twitter', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_twitter', array( 'label' => __( 'Enter your Twitter url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_twitter', 'priority' => 102, ) ) ); $wp_customize->add_setting( 'travel_notes_google', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_google', array( 'label' => __( 'Enter your Google+ url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_google', 'priority' => 103, ) ) ); $wp_customize->add_setting( 'travel_notes_pinterest', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_pinterest', array( 'label' => __( 'Enter your Pinterest url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_pinterest', 'priority' => 104, ) ) ); $wp_customize->add_setting( 'travel_notes_linkedin', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_linkedin', array( 'label' => __( 'Enter your Linkedin url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_linkedin', 'priority' => 105, ) ) ); $wp_customize->add_setting( 'travel_notes_youtube', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_youtube', array( 'label' => __( 'Enter your Youtube url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_youtube', 'priority' => 106, ) ) ); $wp_customize->add_setting( 'travel_notes_tumblr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_tumblr', array( 'label' => __( 'Enter your Tumblr url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_tumblr', 'priority' => 107, ) ) ); $wp_customize->add_setting( 'travel_notes_instagram', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_instagram', array( 'label' => __( 'Enter your Instagram url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_instagram', 'priority' => 108, ) ) ); $wp_customize->add_setting( 'travel_notes_flickr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_flickr', array( 'label' => __( 'Enter your Flickr url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_flickr', 'priority' => 109, ) ) ); $wp_customize->add_setting( 'travel_notes_vimeo', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_vimeo', array( 'label' => __( 'Enter your Vimeo url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_vimeo', 'priority' => 110, ) ) ); $wp_customize->add_setting( 'travel_notes_rss', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_rss', array( 'label' => __( 'Enter your RSS url', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_rss', 'priority' => 112, ) ) ); $wp_customize->add_setting( 'travel_notes_email', array ( 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'travel_notes_email', array( 'label' => __( 'Enter your email address', 'travel-notes' ), 'section' => 'travel_notes_social_section', 'settings' => 'travel_notes_email', 'priority' => 113, ) ) ); } endif; add_action('customize_register', 'travel_notes_theme_customizer'); /** * Sanitize checkbox */ if ( ! function_exists( 'travel_notes_sanitize_checkbox' ) ) : function travel_notes_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } endif; function travel_notes_select( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } }