manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'search_form', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio', ) ); $wp_customize->add_control( 'search_form', array( 'label' => __( 'Search Form', 'affiliateblogwriter' ), 'description' => __( 'Would you like to display the search form in the top menu? PS. This requires a menu to be set for the "Top Menu" position.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Yes (default)', 'no' => 'No', ), 'section' => 'theme_settings', 'priority' => '1', ) ); $wp_customize->add_section( 'theme_settings', array( 'title' => __( 'Theme Settings', 'affiliateblogwriter' ), 'description' => __( 'General theme settings.', 'affiliateblogwriter' ), 'capability' => 'edit_theme_options', 'priority' => 1, ) ); } add_action( 'customize_register', 'affiliateblogwriter_search_form_customizer_settings' ); /** * Function name : affiliateblogwriter_fixed_menu_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_fixed_menu_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_two * * @param affiliateblogwriter_sanitize_radio_two $input input for function. * @param affiliateblogwriter_sanitize_radio_two $setting settings for function. */ function affiliateblogwriter_sanitize_radio_two( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'fixed_menu', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_two', ) ); $wp_customize->add_control( 'fixed_menu', array( 'label' => __( 'Fixed Menu', 'affiliateblogwriter' ), 'description' => __( 'The blue main menu will automatically scroll with the page for large screens by default. You can change that here.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Scroll (default)', 'static' => 'Static, stay on top', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_fixed_menu_customizer_settings' ); /** * Function name : affiliateblogwriter_featured_image_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_featured_image_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_three * * @param affiliateblogwriter_sanitize_radio_three $input input for function. * @param affiliateblogwriter_sanitize_radio_three $setting settings for function. */ function affiliateblogwriter_sanitize_radio_three( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'featured_image', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_three', ) ); $wp_customize->add_control( 'featured_image', array( 'label' => __( 'Featured Image Size', 'affiliateblogwriter' ), 'description' => __( 'You can select the size of the featured images here. Large = 400x300px, Small = 200x150px.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Large (default)', 'small' => 'Small', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_featured_image_customizer_settings' ); /** * Function name : affiliateblogwriter_featured_image_single_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_featured_image_single_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_four * * @param affiliateblogwriter_sanitize_radio_four $input input for function. * @param affiliateblogwriter_sanitize_radio_four $setting settings for function. */ function affiliateblogwriter_sanitize_radio_four( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'featured_image_single', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_four', ) ); $wp_customize->add_control( 'featured_image_single', array( 'label' => __( 'Featured Image Size Single', 'affiliateblogwriter' ), 'description' => __( 'You can select the size of the featured images when vieweing a single post here. Large = 400x300px, Small = 200x150px.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Large (default)', 'small' => 'Small', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_featured_image_single_customizer_settings' ); /** * Function name : affiliateblogwriter_affiliate_notice_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_affiliate_notice_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'affiliate_notice', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( 'affiliate_notice', array( 'label' => __( 'Affiliate Notice', 'affiliateblogwriter' ), 'description' => __( 'You can write your affiliate notice here.', 'affiliateblogwriter' ), 'type' => 'textarea', 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_affiliate_notice_customizer_settings' ); /** * Function name : affiliateblogwriter_affiliate_notice_enable_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_affiliate_notice_enable_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_five * * @param affiliateblogwriter_sanitize_radio_five $input input for function. * @param affiliateblogwriter_sanitize_radio_five $setting settings for function. */ function affiliateblogwriter_sanitize_radio_five( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'affiliate_notice_enable', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_five', ) ); $wp_customize->add_control( 'affiliate_notice_enable', array( 'label' => __( 'Show the Affiliate Notice?', 'affiliateblogwriter' ), 'description' => __( 'You can toggle the display of this notice here.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Yes, when enabled with custom fields (default)', 'yes' => 'Yes, show on all posts', 'sidebar' => 'Show in sidebar instead', 'no' => 'No, do not show the affiliate notice anywhere', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_affiliate_notice_enable_customizer_settings' ); /** * Function name : affiliateblogwriter_show_author_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_show_author_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_six * * @param affiliateblogwriter_sanitize_radio_six $input input for function. * @param affiliateblogwriter_sanitize_radio_six $setting settings for function. */ function affiliateblogwriter_sanitize_radio_six( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'show_author', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_six', ) ); $wp_customize->add_control( 'show_author', array( 'label' => __( 'Show Author?', 'affiliateblogwriter' ), 'description' => __( 'You can select to show the author below titles for posts and pages here.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'No (default)', 'yes' => 'Yes', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_show_author_customizer_settings' ); /** * Function name : affiliateblogwriter_sticky_notice_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_sticky_notice_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_nine * * @param affiliateblogwriter_sanitize_radio_nine $input input for function. * @param affiliateblogwriter_sanitize_radio_nine $setting settings for function. */ function affiliateblogwriter_sanitize_radio_nine( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'sticky_notice', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_nine', ) ); $wp_customize->add_control( 'sticky_notice', array( 'label' => __( 'Sticky Notice', 'affiliateblogwriter' ), 'description' => __( 'If you don\'t want the theme to show "featured post" notices for sticky posts, you can disable it here.', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Yes, (default)', 'no' => 'No', ), 'section' => 'theme_settings', ) ); } add_action( 'customize_register', 'affiliateblogwriter_sticky_notice_customizer_settings' ); /** * Function name : affiliateblogwriter_profile_photo_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_profile_photo_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_file * * @param affiliateblogwriter_sanitize_file $file file for function. * @param affiliateblogwriter_sanitize_file $setting settings for function. */ function affiliateblogwriter_sanitize_file( $file, $setting ) { $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', ); $file_ext = wp_check_filetype( $file, $mimes ); return ( $file_ext['ext'] ? $file : $setting->default ); } $wp_customize->add_setting( 'profile_photo', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_file', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'profile_photo', array( 'label' => __( 'Your Photo', 'affiliateblogwriter' ), 'section' => 'about_blogger', 'settings' => 'profile_photo', 'width' => 250, 'height' => 300, ) ) ); $wp_customize->add_section( 'about_blogger', array( 'title' => __( 'About the Blogger', 'affiliateblogwriter' ), 'description' => __( 'Add some details about yourself or your company to make the blog more personal.', 'affiliateblogwriter' ), 'capability' => 'edit_theme_options', 'priority' => 2, ) ); } add_action( 'customize_register', 'affiliateblogwriter_profile_photo_customizer_settings' ); /** * Function name : affiliateblogwriter_short_bio_title_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_short_bio_title_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'short_bio_title', array( 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_control( 'short_bio_title', array( 'label' => __( 'Short Bio Title', 'affiliateblogwriter' ), 'description' => __( 'Default to "About me". You can change it here.', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'about_blogger', ) ); } add_action( 'customize_register', 'affiliateblogwriter_short_bio_title_customizer_settings' ); /** * Function name : affiliateblogwriter_short_bio_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_short_bio_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'short_bio', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( 'short_bio', array( 'label' => __( 'Short Bio', 'affiliateblogwriter' ), 'description' => __( 'I would suggest to keep this as short as possible as it appears on every page in the sidebar.', 'affiliateblogwriter' ), 'type' => 'textarea', 'section' => 'about_blogger', ) ); } add_action( 'customize_register', 'affiliateblogwriter_short_bio_customizer_settings' ); /** * Function name : affiliateblogwriter_social_media_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_social_media_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_ten * * @param affiliateblogwriter_sanitize_radio_ten $input input for function. * @param affiliateblogwriter_sanitize_radio_ten $setting settings for function. */ function affiliateblogwriter_sanitize_radio_ten( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'social_media', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_ten', ) ); $wp_customize->add_control( 'social_media', array( 'label' => __( 'Social Media', 'affiliateblogwriter' ), 'description' => __( 'Where would you like to show these icons?', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'default' => 'Sidebar (default)', 'footer' => 'Footer', 'hide' => 'Don\'t show', ), 'section' => 'social_media_links', 'priority' => '1', ) ); $wp_customize->add_section( 'social_media_links', array( 'title' => __( 'Social Media', 'affiliateblogwriter' ), 'description' => __( 'Link to your social media profiles. Please use full URLs including "https://".', 'affiliateblogwriter' ), 'capability' => 'edit_theme_options', 'priority' => 3, ) ); } add_action( 'customize_register', 'affiliateblogwriter_social_media_customizer_settings' ); /** * Function name : affiliateblogwriter_facebook_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_facebook_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'facebook_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'facebook_link', array( 'label' => __( 'Facebook', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_facebook_customizer_settings' ); /** * Function name : affiliateblogwriter_twitter_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_twitter_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'twitter_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'twitter_link', array( 'label' => __( 'Twitter', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_twitter_customizer_settings' ); /** * Function name : affiliateblogwriter_instagram_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_instagram_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'instagram_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'instagram_link', array( 'label' => __( 'Instagram', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_instagram_customizer_settings' ); /** * Function name : affiliateblogwriter_linkedin_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_linkedin_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'linkedin_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'linkedin_link', array( 'label' => __( 'LinkedIn', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_linkedin_customizer_settings' ); /** * Function name : affiliateblogwriter_youtube_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_youtube_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'youtube_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'youtube_link', array( 'label' => __( 'YouTube', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_youtube_customizer_settings' ); /** * Function name : affiliateblogwriter_snapchat_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_snapchat_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'snapchat_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'snapchat_link', array( 'label' => __( 'Snapchat', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_snapchat_customizer_settings' ); /** * Function name : affiliateblogwriter_pinterest_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_pinterest_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'pinterest_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'pinterest_link', array( 'label' => __( 'Pinterest', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_pinterest_customizer_settings' ); /** * Function name : affiliateblogwriter_github_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_github_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'github_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'github_link', array( 'label' => __( 'Github', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_github_customizer_settings' ); /** * Function name : affiliateblogwriter_reddit_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_reddit_customizer_settings( $wp_customize ) { $wp_customize->add_setting( 'reddit_link', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'reddit_link', array( 'label' => __( 'Reddit', 'affiliateblogwriter' ), 'type' => 'textfield', 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_reddit_customizer_settings' ); /** * Function name : affiliateblogwriter_rss_customizer_settings * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function affiliateblogwriter_rss_customizer_settings( $wp_customize ) { /** * Function name: affiliateblogwriter_sanitize_radio_eleven * * @param affiliateblogwriter_sanitize_radio_eleven $input input for function. * @param affiliateblogwriter_sanitize_radio_eleven $setting settings for function. */ function affiliateblogwriter_sanitize_radio_eleven( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } $wp_customize->add_setting( 'rss_link', array( 'sanitize_callback' => 'affiliateblogwriter_sanitize_radio_eleven', ) ); $wp_customize->add_control( 'rss_link', array( 'label' => __( 'RSS', 'affiliateblogwriter' ), 'type' => 'radio', 'choices' => array( 'yes' => 'Yes (default)', 'no' => 'No', ), 'section' => 'social_media_links', ) ); } add_action( 'customize_register', 'affiliateblogwriter_rss_customizer_settings' );