/** * Configure settings and controls for the Logo section. * * @since 1.0.0. * * @param object $wp_customize The global customizer object. * @param string $section The section name. * @return void */ function ttfmake_customizer_logo($wp_customize, $section) { $priority = new TTFMAKE_Prioritizer(); $control_prefix = 'ttfmake_'; $setting_prefix = str_replace($control_prefix, '', $section); // Regular Logo $setting_id = $setting_prefix . '-regular'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Regular Logo', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id))); // Retina Logo $setting_id = $setting_prefix . '-retina'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Retina Logo (2x)', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id))); // Retina info $setting_id = $setting_prefix . '-retina-info'; $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('The Retina Logo should be twice the size of the Regular Logo.', 'make'), 'priority' => $priority->add()))); // Favicon $setting_id = $setting_prefix . '-favicon'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Favicon', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id, 'extensions' => array('png', 'ico')))); // Favicon info $setting_id = $setting_prefix . '-favicon-info'; $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('File must be <strong>.png</strong> or <strong>.ico</strong> format. Optimal dimensions: <strong>32px x 32px</strong>.', 'make'), 'priority' => $priority->add()))); // Apple Touch Icon $setting_id = $setting_prefix . '-apple-touch'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Apple Touch Icon', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id, 'extensions' => array('png')))); // Apple Touch Icon info $setting_id = $setting_prefix . '-apple-touch-info'; $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'text', 'description' => __('File must be <strong>.png</strong> format. Optimal dimensions: <strong>152px x 152px</strong>.', 'make'), 'priority' => $priority->add()))); }
/** * Creates currency options * * @access public * @param object $wp_customize * @param int $count * @return void */ public static function currency_settings($wp_customize, $count) { for ($i = 1; $i <= $count; $i++) { $wp_customize->add_section("realia_currencies[{$i}]", array('title' => __('Realia', 'realia') . ' ' . ($i + 1) . '. ' . __('Currency', 'realia'), 'priority' => 1)); // Currency symbol $wp_customize->add_setting("realia_currencies[{$i}][symbol]", array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][symbol]", array('label' => __('Currency Symbol', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][symbol]")); // Currency code $wp_customize->add_setting("realia_currencies[{$i}][code]", array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][code]", array('label' => __('Currency Code', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][code]")); // Show after $wp_customize->add_setting("realia_currencies[{$i}][show_after]", array('default' => false, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][show_after]", array('type' => 'checkbox', 'label' => __('Show Symbol After Amount', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][show_after]")); // Decimal places $wp_customize->add_setting("realia_currencies[{$i}][money_decimals]", array('default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][money_decimals]", array('label' => __('Decimal places', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][money_decimals]")); // Decimal separator $wp_customize->add_setting("realia_currencies[{$i}][money_dec_point]", array('default' => '.', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}]_money_dec_point", array('label' => __('Decimal Separator', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][money_dec_point]")); // Thousands Separator $wp_customize->add_setting("realia_currencies[{$i}][money_thousands_separator]", array('default' => ',', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][money_thousands_separator]", array('label' => __('Thousands Separator', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][money_thousands_separator]", 'description' => __('If you need space, enter &nbsp;', 'realia'))); // Rate $wp_customize->add_setting("realia_currencies[{$i}][rate]", array('default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control("realia_currencies[{$i}][rate]", array('label' => __('Rate', 'realia'), 'section' => "realia_currencies[{$i}]", 'settings' => "realia_currencies[{$i}][rate]", 'description' => __('Rate from default currency', 'realia'))); } }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @since 1.4.0 * @access private * @param object $wp_customize */ function spine2_customize_register($wp_customize) { /* Get the theme prefix. */ $prefix = hybrid_get_prefix(); /* Add the color scheme section. */ /* $wp_customize->add_section( 'spine-scheme', array( 'title' => esc_html__( 'Color Scheme', 'spine' ), 'priority' => 200, 'capability' => 'edit_theme_options' ) );*/ /*Add the ' color scheme ' setting. $wp_customize->add_setting( "{$prefix}_theme_settings[color_scheme_select]", array( 'default' => 'default', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'spine2_customize_sanitize', 'sanitize_js_callback' => 'spine2_customize_sanitize', 'transport' => 'postMessage', ) ); $schemes = array( 'default' => __('Default', 'spine'), 'blue' => __('Blue', 'spine'), 'red' => __('Red', 'spine'), 'green' => __('Green', 'spine'), ); $wp_customize->add_control( 'spine_color_scheme', array( 'label' => __( 'Color Scheme', 'spine' ), 'section'=> 'spine-scheme', 'settings'=> "{$prefix}_theme_settings[color_scheme_select]", 'type'=> 'radio', 'choices'=> $schemes ) ); */ $wp_customize->add_setting("{$prefix}_theme_settings[headline_color]", array('default' => '#2795b6', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'spine2_customize_sanitize', 'sanitize_js_callback' => 'spine2_customize_sanitize', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'headline_color', array('label' => __('Headline color', 'spine'), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[headline_color]"))); $wp_customize->add_setting("{$prefix}_theme_settings[body_color]", array('default' => '#222', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'spine2_customize_sanitize', 'sanitize_js_callback' => 'spine2_customize_sanitize', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_color', array('label' => __('Body Text color', 'spine'), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[body_color]"))); $wp_customize->add_setting("{$prefix}_theme_settings[link_color]", array('default' => '#2ba6cb', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'spine2_customize_sanitize', 'sanitize_js_callback' => 'spine2_customize_sanitize', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Text color', 'spine'), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[link_color]"))); $wp_customize->add_setting("{$prefix}_theme_settings[link_hover_color]", array('default' => '#2795b6', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'spine2_customize_sanitize', 'sanitize_js_callback' => 'spine2_customize_sanitize', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_hover_color', array('label' => __('Link Hover Text color', 'spine'), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[link_hover_color]"))); $wp_customize->add_setting("{$prefix}_theme_settings[logo_upload]", array('default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new My_Customize_Image_Reloaded_Control($wp_customize, 'logo_upload', array('label' => 'Logo Upload', 'section' => 'title_tagline', 'settings' => "{$prefix}_theme_settings[logo_upload]"))); /* If viewing the customize preview screen, add a script to show a live preview. */ if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'spine2_customize_preview_script', 21); } }
/** * Customizations * * @access public * @param object $wp_customize * @return void */ public static function customizations($wp_customize) { $wp_customize->add_section('realia_recaptcha', array('title' => __('Realia reCAPTCHA', 'realia'), 'priority' => 1)); // Site key $wp_customize->add_setting('realia_recaptcha_site_key', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_recaptcha_site_key', array('label' => __('Site Key', 'realia'), 'section' => 'realia_recaptcha', 'settings' => 'realia_recaptcha_site_key')); // Secret key $wp_customize->add_setting('realia_recaptcha_secret_key', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_recaptcha_secret_key', array('label' => __('Secret Key', 'realia'), 'section' => 'realia_recaptcha', 'settings' => 'realia_recaptcha_secret_key')); }
/** * Registers options with the Theme Customizer * * @param object $wp_customize The WordPress Theme Customizer * @package peacock * @since 1.0.0 * @version 1.0.0 */ function peacock_register_theme_customizer($wp_customize) { $wp_customize->add_section('peacock_mainheader_options', array('title' => __('Main Header Section', 'peacock'), 'priority' => 20)); /* Home Cta Title */ $wp_customize->add_setting('peacock_mainheader_title', array('default' => __('Wordpress With Peacock', 'peacock'), 'sanitize_callback' => 'peacock_sanitize_input', 'transport' => 'refresh')); $wp_customize->add_control('peacock_mainheader_title', array('section' => 'peacock_mainheader_options', 'label' => __('Title', 'peacock'), 'type' => 'text')); /* Home Cta Subtitle */ $wp_customize->add_setting('peacock_mainheader_subtitle', array('default' => __('Life is short', 'peacock'), 'sanitize_callback' => 'peacock_sanitize_input', 'transport' => 'refresh')); $wp_customize->add_control('peacock_mainheader_subtitle', array('section' => 'peacock_mainheader_options', 'label' => __('Subtitle', 'peacock'), 'type' => 'text')); }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @since 0.3.2 * @access private * @param object $wp_customize */ function omega_customize_logo_register($wp_customize) { /* Add the footer section. */ $wp_customize->add_section('title_tagline', array('title' => esc_html__('Branding', 'omega'), 'priority' => 1, 'capability' => 'edit_theme_options')); /* Add the 'custom_logo' setting. */ $wp_customize->add_setting("custom_logo", array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); /* Add the textarea control for the 'custom_css' setting. */ $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_logo', array('label' => esc_html__('Logo', 'omega'), 'section' => 'title_tagline', 'settings' => "custom_logo"))); /* Add the 'custom_favicon' setting. */ $wp_customize->add_setting("custom_favicon", array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); /* Add the textarea control for the 'custom_css' setting. */ $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_favicon', array('label' => esc_html__('Favicon', 'omega'), 'section' => 'title_tagline', 'settings' => "custom_favicon"))); }
/** * Configure settings and controls for the General section * * @since 1.0.0. * * @param object $wp_customize The global customizer object. * @param string $section The section name. * @return void */ function ttfmake_customizer_general($wp_customize, $section) { $priority = new TTFMAKE_Prioritizer(); $control_prefix = 'ttfmake_'; $setting_prefix = str_replace($control_prefix, '', $section); // Site Layout $setting_id = $setting_prefix . '-layout'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Site Layout', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add())); // Sticky label $setting_id = $setting_prefix . '-sticky-label'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_html', 'transport' => 'postMessage')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Sticky Label', 'make'), 'type' => 'text', 'priority' => $priority->add())); }
/** * Add our logo uploader to the Customizer. * * @param object $wp_customize Customizer object. * @uses current_theme_supports() * @uses current_theme_supports() * @uses WP_Customize_Manager::add_setting() * @uses WP_Customize_Manager::add_control() * @uses Site_Logo::sanitize_checkbox() */ public function customize_register($wp_customize) { // Include our custom control. require dirname(__FILE__) . '/class-site-logo-control.php'; // Add a setting to hide header text if the theme isn't supporting the feature itself if (!current_theme_supports('custom-header')) { $wp_customize->add_setting('site_logo_header_text', array('default' => 1, 'sanitize_callback' => array($this, 'sanitize_checkbox'), 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'site_logo_header_text', array('label' => __('Display Header Text', 'site-logo'), 'section' => 'title_tagline', 'settings' => 'site_logo_header_text', 'type' => 'checkbox'))); } // Add the setting for our logo value. $wp_customize->add_setting('site_logo', array('default' => array('url' => false, 'id' => 0), 'type' => 'option', 'capability' => 'manage_options', 'transport' => 'postMessage')); // Add our image uploader. $wp_customize->add_control(new Site_Logo_Image_Control($wp_customize, 'site_logo', array('label' => __('Site Logo', 'site-logo'), 'section' => 'title_tagline', 'settings' => 'site_logo'))); }
/** * Add our logo uploader to the Customizer. * * @param object $wp_customize Customizer object. * @uses current_theme_supports() * @uses current_theme_supports() * @uses WP_Customize_Manager::add_setting() * @uses WP_Customize_Manager::add_control() * @uses GenLib_Site_Logo::sanitize_checkbox() */ public function register($wp_customize) { //Update the Customizer section title for discoverability. $wp_customize->get_section('title_tagline')->title = __('Site Title, Tagline, and Logo', 'genlib'); // Disable the display header text control from the custom header feature. if (current_theme_supports('custom-header')) { $wp_customize->remove_control('display_header_text'); } // Add a setting to hide header text. $wp_customize->add_setting('site_logo_header_text', array('default' => 1, 'sanitize_callback' => 'absint', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'site_logo_header_text', array('label' => __('Display Header Text', 'genlib'), 'section' => 'title_tagline', 'settings' => 'site_logo_header_text', 'type' => 'checkbox'))); // Add the setting for our logo value. $wp_customize->add_setting('site_logo', array('capability' => $this->capability, 'default' => array('id' => 0, 'sizes' => array(), 'url' => false), 'sanitize_callback' => array($this, 'sanitize_logo_setting'), 'transport' => 'postMessage', 'type' => 'option')); // Add our image uploader. $wp_customize->add_control(new GenLib_Site_Logo_Image_Control($wp_customize, 'site_logo', array('label' => __('Logo', 'genlib'), 'section' => 'title_tagline', 'settings' => 'site_logo'))); }
/** * Customizations * * @access public * @param object $wp_customize * @return void */ public static function customizations($wp_customize) { $wp_customize->add_section('realia_measurement', array('title' => __('Realia Measurement', 'realia'), 'priority' => 1)); // Area unit $wp_customize->add_setting('realia_measurement_area_unit', array('default' => 'sqft', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_measurement_area_unit', array('label' => __('Area Unit', 'realia'), 'section' => 'realia_measurement', 'settings' => 'realia_measurement_area_unit')); }
/** * Customizations * * @access public * @param object $wp_customize * @return void */ public static function customizations($wp_customize) { $wp_customize->add_section('realia_paypal', array('title' => __('Realia PayPal', 'realia'), 'priority' => 1)); // PayPal Client ID $wp_customize->add_setting('realia_paypal_client_id', array('default' => null, 'crability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_paypal_client_id', array('label' => __('Client ID', 'realia'), 'section' => 'realia_paypal', 'settings' => 'realia_paypal_client_id')); // PayPal Client Secret $wp_customize->add_setting('realia_paypal_client_secret', array('default' => null, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_paypal_client_secret', array('label' => __('Client Secret', 'realia'), 'section' => 'realia_paypal', 'settings' => 'realia_paypal_client_secret')); // PayPal Live Mode $wp_customize->add_setting('realia_paypal_live', array('default' => false, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_paypal_live', array('label' => __('Live Mode', 'realia'), 'type' => 'checkbox', 'section' => 'realia_paypal', 'settings' => 'realia_paypal_live')); // Credit card $wp_customize->add_setting('realia_paypal_credit_card', array('default' => false, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('realia_paypal_credit_card', array('label' => __('Credit Card', 'realia'), 'type' => 'checkbox', 'section' => 'realia_paypal', 'settings' => 'realia_paypal_credit_card')); }
/** * Sets up the theme customizer sections, controls, and settings. * * @since 1.0.0 * @access public * @param object $wp_customize * @return void */ function saga_customize_register($wp_customize) { /* Load the Font Awesome definitions. */ require_once trailingslashit(get_template_directory()) . 'inc/font-icons.php'; /* Load JavaScript files. */ add_action('customize_preview_init', 'saga_enqueue_customizer_scripts'); /* Load CSS files. */ add_action('customize_controls_print_styles', 'saga_customize_controls_print_styles'); /* Enable live preview for WordPress theme features. */ $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; $wp_customize->get_setting('header_image')->transport = 'postMessage'; $wp_customize->get_setting('background_color')->transport = 'postMessage'; $wp_customize->get_setting('background_image')->transport = 'postMessage'; $wp_customize->get_setting('background_position_x')->transport = 'postMessage'; $wp_customize->get_setting('background_repeat')->transport = 'postMessage'; $wp_customize->get_setting('background_attachment')->transport = 'postMessage'; /* Remove the WordPress background image control. */ $wp_customize->remove_control('background_image'); /* Add our custom background image control. */ $wp_customize->add_control(new Hybrid_Customize_Control_Background_Image($wp_customize)); /* Adds the header icon setting. */ $wp_customize->add_setting('header_icon', array('default' => get_theme_mod('header_icon', 'default'), 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', 'sanitize_js_callback' => 'esc_attr', 'transport' => 'postMessage')); /* Adds the header icon control. */ $wp_customize->add_control('saga-header-icon', array('label' => __('Header Icon', 'saga'), 'section' => 'title_tagline', 'settings' => 'header_icon', 'type' => 'select', 'choices' => saga_get_header_icon_choices())); }
/** * Add our logo uploader to the Customizer. * * @param object $wp_customize Customizer object. * @uses current_theme_supports() * @uses current_theme_supports() * @uses WP_Customize_Manager::add_setting() * @uses WP_Customize_Manager::add_control() * @uses Site_Logo::sanitize_checkbox() */ public function customize_register($wp_customize) { // Include our custom control. require_once dirname(__FILE__) . '/class-site-logo-control.php'; //Update the Customizer section title for discoverability. $wp_customize->get_section('title_tagline')->title = __('Site Title, Tagline, and Logo', 'layerswp'); // Add a setting to hide header text if the theme isn't supporting the feature itself if (!current_theme_supports('custom-header')) { $wp_customize->add_setting('site_logo_header_text', array('default' => 1, 'sanitize_callback' => array($this, 'sanitize_checkbox'), 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'site_logo_header_text', array('label' => __('Display Header Text', 'layerswp'), 'section' => 'title_tagline', 'settings' => 'site_logo_header_text', 'type' => 'checkbox'))); } // Add the setting for our logo value. $wp_customize->add_setting('site_logo', array('capability' => 'manage_options', 'default' => array('id' => 0, 'sizes' => array(), 'url' => false), 'sanitize_callback' => array($this, 'sanitize_logo_setting'), 'transport' => 'refresh', 'type' => 'option')); // Add our image uploader. $wp_customize->add_control(new Site_Logo_Image_Control($wp_customize, 'site_logo', array('label' => __('Logo', 'layerswp'), 'section' => 'title_tagline', 'settings' => 'site_logo'))); }
/** * Register our Customizer settings and controls. * * @since 1.0.0 * * @param object $wp_customize The Customizer object. */ public function customize_register($wp_customize) { /** * Set up our defaults. */ $defaults = $this->get_option_defaults(); $bg_colors = $this->get_bg_colors(); $text_colors = $this->get_text_colors(); /** * Register our settings and controls. */ /* Colors */ // Body Background. $wp_customize->add_setting('alcatraz_designer_options[body_bg_color]', array('default' => $defaults['body_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_body_bg_color', array('label' => __('Body Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[body_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Header Background. $wp_customize->add_setting('alcatraz_designer_options[header_bg_color]', array('default' => $defaults['header_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_header_bg_color', array('label' => __('Header Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[header_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Header Text. $wp_customize->add_setting('alcatraz_designer_options[header_text_color]', array('default' => $defaults['header_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_header_text_color', array('label' => __('Header Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[header_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); // Menu Background. $wp_customize->add_setting('alcatraz_designer_options[menu_bg_color]', array('default' => $defaults['menu_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_menu_bg_color', array('label' => __('Menu Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[menu_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Menu Text. $wp_customize->add_setting('alcatraz_designer_options[menu_text_color]', array('default' => $defaults['menu_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_menu_text_color', array('label' => __('Menu Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[menu_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); // Sub Menu Background. $wp_customize->add_setting('alcatraz_designer_options[sub_menu_bg_color]', array('default' => $defaults['sub_menu_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_sub_menu_bg_color', array('label' => __('Sub Menu Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[sub_menu_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Sub Menu Text. $wp_customize->add_setting('alcatraz_designer_options[sub_menu_text_color]', array('default' => $defaults['sub_menu_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_sub_menu_text_color', array('label' => __('Sub Menu Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[sub_menu_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); // Content Area Background. $wp_customize->add_setting('alcatraz_designer_options[content_bg_color]', array('default' => $defaults['content_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_content_bg_color', array('label' => __('Content Area Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[content_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Content Area Text. $wp_customize->add_setting('alcatraz_designer_options[content_text_color]', array('default' => $defaults['content_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_content_text_color', array('label' => __('Content Area Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[content_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); // Sidebar Background. $wp_customize->add_setting('alcatraz_designer_options[sidebar_bg_color]', array('default' => $defaults['sidebar_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_sidebar_bg_color', array('label' => __('Sidebar Background Color', 'alcatraz-designer'), 'description' => __('Only shows on certain page layouts', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[sidebar_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Sidebar Text. $wp_customize->add_setting('alcatraz_designer_options[sidebar_text_color]', array('default' => $defaults['sidebar_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_sidebar_text_color', array('label' => __('Sidebar Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[sidebar_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); // Footer Background. $wp_customize->add_setting('alcatraz_designer_options[footer_bg_color]', array('default' => $defaults['footer_bg_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_footer_bg_color', array('label' => __('Footer Background Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[footer_bg_color]', 'show_opacity' => true, 'palette' => $bg_colors))); // Footer Text. $wp_customize->add_setting('alcatraz_designer_options[footer_text_color]', array('default' => $defaults['footer_text_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control(new Alcatraz_Customize_Alpha_Color_Control($wp_customize, 'alcatraz_designer_options_footer_text_color', array('label' => __('Footer Text Color', 'alcatraz-designer'), 'section' => 'colors', 'settings' => 'alcatraz_designer_options[footer_text_color]', 'show_opacity' => true, 'palette' => $text_colors))); }
/** * Adds all general settings to the Customizer * * @param object $wp_customize / Customizer Object */ function zeepersonal_customize_register_general_settings($wp_customize) { // Add Section for Theme Options $wp_customize->add_section('zeepersonal_section_general', array('title' => esc_html__('General Settings', 'zeepersonal'), 'priority' => 10, 'panel' => 'zeepersonal_options_panel')); // Add Settings and Controls for Layout $wp_customize->add_setting('zeepersonal_theme_options[layout]', array('default' => 'right-sidebar', 'type' => 'option', 'transport' => 'refresh', 'sanitize_callback' => 'zeepersonal_sanitize_layout')); $wp_customize->add_control('zeepersonal_control_layout', array('label' => esc_html__('Theme Layout', 'zeepersonal'), 'section' => 'zeepersonal_section_general', 'settings' => 'zeepersonal_theme_options[layout]', 'type' => 'radio', 'priority' => 1, 'choices' => array('left-sidebar' => esc_html__('Left Sidebar', 'zeepersonal'), 'right-sidebar' => esc_html__('Right Sidebar', 'zeepersonal')))); }
/** * Customize: Cat/Term Section. * * Customizer register function for Cat/Term Section * * @param object $wp_customize WP_Customize Instance of the WP_Customize_Manager class. * @since 1.0.0 */ function vr_customize_cat_term($wp_customize) { // Section: Category/Term. $wp_customize->add_section('vr_section_cat_term', array('priority' => 39, 'panel' => 'vr_panel_options', 'title' => __('Category/Term', 'VRC'), 'description' => __('Category or Term related settings', 'VRC'), 'capability' => 'edit_theme_options')); // Setting: Cat/Term Image. $wp_customize->add_setting('vr_cat_term_img', array('type' => 'theme_mod', 'default' => VRC_URL . '/assets/plugin/category-images/assets/img/placeholder.png', 'transport' => 'refresh', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'vr_sanitize_ci_img')); // Control: Cat/Term Image. $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'vr_cat_term_img', array('label' => __('Upload a default image for category/term!', 'VRC'), 'section' => 'vr_section_cat_term', 'settings' => 'vr_cat_term_img'))); }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @since 0.3.2 * @access private * @param object $wp_customize */ function omega_customize_comment_register($wp_customize) { /* Add the comment section. */ $wp_customize->add_section('comment_section', array('title' => esc_html__('Comments', 'omega'), 'priority' => 121, 'capability' => 'edit_theme_options')); /* Add the 'custom_comment' setting. */ $wp_customize->add_setting("page_comment", array('default' => false, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); /* Add the checkbox control for the 'custom_comment' setting. */ $wp_customize->add_control(new Omega_Customize_Control_Checkbox($wp_customize, 'page_comment', array('label' => esc_html__('Enable comments on pages ', 'omega'), 'section' => 'comment_section', 'settings' => 'page_comment', 'extra' => esc_html__('This option will enable comments on pages. Comments can also be disabled per page basis when creating/editing pages.', 'omega')))); }
/** * Register our customizer breadcrumb options for the parent class to load. * * @since 1.1.0 * @access public * @param object $wp_customize * @return void */ public function register($wp_customize) { $wp_customize->add_section($this->section, array('title' => __('Breadcrumbs', 'flagship-library'), 'description' => __('Choose where you would like breadcrumbs to display.', 'flagship-library'), 'priority' => 110, 'capability' => $this->capability)); $priority = 10; foreach ($this->get_options() as $breadcrumb => $setting) { $wp_customize->add_setting($breadcrumb, array('default' => $setting['default'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control($breadcrumb, array('label' => $setting['label'], 'section' => $this->section, 'type' => 'checkbox', 'priority' => $priority++)); } }
/** * Add our logo uploader to the Customizer. * * @param object $wp_customize Customizer object. * @uses $wp_customize->add_setting * @uses $wp_customize->add_control * @since 1.0.0 */ function kuorinka_plus_logo_customize_register($wp_customize) { /* === Logo upload. === */ /* Add the logo section. */ $wp_customize->add_section('logo', array('title' => esc_html__('Logo', 'kuorinka-plus'), 'priority' => 10, 'panel' => 'kuorinka_plus_panel')); /* Add the setting for our logo value. */ $wp_customize->add_setting('site_logo', array('default' => '', 'sanitize_callback' => 'absint')); /* Add our image uploader. */ $wp_customize->add_control(new WP_Customize_Cropped_Image_Control($wp_customize, 'site_logo', array('label' => __('Site Logo', 'kuorinka-plus'), 'section' => 'logo', 'flex_width' => true, 'flex_height' => true, 'width' => 240, 'height' => 80))); }
/** * Register our customizer breadcrumb options for the parent class to load. * * @since 1.0.0 * @access public * @param object $wp_customize The WordPress customizer API object. * @return void */ function carelib_register_breadcrumb_settings($wp_customize) { $section = "{$GLOBALS['carelib_prefix']}_breadcrumbs"; $wp_customize->add_section($section, array('title' => __('Breadcrumbs', 'carelib'), 'description' => __('Choose where you would like breadcrumbs to display.', 'carelib'), 'priority' => 110, 'capability' => 'edit_theme_options')); $priority = 10; foreach (carelib_get_breadcrumb_options() as $breadcrumb => $setting) { $wp_customize->add_setting($breadcrumb, array('default' => $setting['default'], 'sanitize_callback' => 'absint')); $wp_customize->add_control($breadcrumb, array('label' => $setting['label'], 'section' => $section, 'type' => 'checkbox', 'priority' => $priority++)); } }
/** * Register a Setting in the customizer */ private function registerSetting($storage_type, $id, $options) { // Add the setting prefix. $id = $this->setting_prefix . $id; // Validate the options $validated_options = $this->validator->validate('setting', $options); // Add in the storage type $validated_options['type'] = $storage_type; // Register the Setting $this->wp_customize->add_setting($id, $validated_options); }
/** * Sets up the theme customizer sections, controls, and settings. * * @since 1.0.0 * @access public * @param object $wp_customize * @return void */ function ravel_customize_register($wp_customize) { /* Load JavaScript files. */ add_action('customize_preview_init', 'ravel_enqueue_customizer_scripts'); /* Enable live preview for WordPress theme features. */ $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; /* Add single-letter site title setting. */ $wp_customize->add_setting('single_letter', array('default' => false, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); /* Add a control for the single letter setting. */ $wp_customize->add_control('ravel-single-letter', array('label' => esc_html__('Use single letter title', 'ravel'), 'section' => 'title_tagline', 'settings' => 'single_letter', 'type' => 'checkbox')); }
/** * Registers options with the Theme Customizer * * @param object $wp_customize The WordPress Theme Customizer * @package tcx * @since 0.2.0 * @version 1.0.0 */ function tcx_register_theme_customizer($wp_customize) { $wp_customize->add_setting('tcx_link_color', array('default' => '#000000', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => 'Link Color', 'section' => 'colors', 'settings' => 'tcx_link_color'))); /*-----------------------------------------------------------* * Defining our own 'Display Options' section *-----------------------------------------------------------*/ $wp_customize->add_section('tcx_display_options', array('title' => 'Display Options', 'priority' => 200)); /* Display Header */ $wp_customize->add_setting('tcx_display_header', array('default' => 'true', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control('tcx_display_header', array('section' => 'tcx_display_options', 'label' => 'Display Header?', 'type' => 'checkbox')); /* Change Color Scheme */ $wp_customize->add_setting('tcx_color_scheme', array('default' => 'normal', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control('tcx_color_scheme', array('section' => 'tcx_display_options', 'label' => 'Color Scheme', 'type' => 'radio', 'choices' => array('normal' => 'Normal', 'inverse' => 'Inverse'))); /* Change Font */ $wp_customize->add_setting('tcx_font', array('default' => 'times', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control('tcx_font', array('section' => 'tcx_display_options', 'label' => 'Theme Font', 'type' => 'select', 'choices' => array('times' => 'Times New Roman', 'arial' => 'Arial', 'courier' => 'Courier New'))); /* Display Copyright */ $wp_customize->add_setting('tcx_footer_copyright_text', array('default' => 'All Rights Reserved', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control('tcx_footer_copyright_text', array('section' => 'tcx_display_options', 'label' => 'Copyright Message', 'type' => 'text')); /*-----------------------------------------------------------* * Defining our own 'Advanced Options' section *-----------------------------------------------------------*/ $wp_customize->add_section('tcx_advanced_options', array('title' => 'Advanced Options', 'priority' => 201)); /* Background Image */ $wp_customize->add_setting('tcx_background_image', array('default' => '', 'sanitize_callback' => 'tcx_sanitize_input', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'tcx_background_image', array('label' => 'Background Image', 'settings' => 'tcx_background_image', 'section' => 'tcx_advanced_options'))); }
/** * Configure settings and controls for the Main section. * * @since 1.0.0. * * @param object $wp_customize The global customizer object. * @param string $section The section name. * @return void */ function ttfmake_customizer_main($wp_customize, $section) { $priority = new TTFMAKE_Prioritizer(); $control_prefix = 'ttfmake_'; $setting_prefix = str_replace($control_prefix, '', $section); // Background color $setting_id = $setting_prefix . '-background-color'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Color', 'make'), 'priority' => $priority->add()))); // Background Image $setting_id = $setting_prefix . '-background-image'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new TTFMAKE_Customize_Image_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Image', 'make'), 'priority' => $priority->add(), 'context' => $control_prefix . $setting_id))); // Background Repeat $setting_id = $setting_prefix . '-background-repeat'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Repeat', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add())); // Background Position $setting_id = $setting_prefix . '-background-position'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Position', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add())); // Background Size $setting_id = $setting_prefix . '-background-size'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'ttfmake_sanitize_choice')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Background Size', 'make'), 'type' => 'radio', 'choices' => ttfmake_get_choices($setting_id), 'priority' => $priority->add())); // Content options heading $setting_id = $setting_prefix . '-content-heading'; $wp_customize->add_control(new TTFMAKE_Customize_Misc_Control($wp_customize, $control_prefix . $setting_id, array('section' => $section, 'type' => 'heading', 'label' => __('Content Options', 'make'), 'priority' => $priority->add()))); // Underline content links $setting_id = $setting_prefix . '-content-link-underline'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'absint')); $wp_customize->add_control($control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Underline links in content', 'make'), 'type' => 'checkbox', 'priority' => $priority->add())); }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @since 1.4.0 * @access private * @param object $wp_customize */ function omega_customize_footer_register($wp_customize) { /* Add the section. */ $wp_customize->add_section('footer', array('title' => esc_html__('Footer', 'omega'), 'priority' => 149, 'capability' => 'edit_theme_options')); /* Add the 'footer_insert' setting. */ $wp_customize->add_setting("custom_footer", array('default' => apply_filters('omega_footer_insert', ''), 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'omega_customize_sanitize', 'sanitize_js_callback' => 'omega_customize_sanitize', 'transport' => 'postMessage')); /* Add the textarea control for the 'footer_insert' setting. */ $wp_customize->add_control(new Omega_Customize_Control_Textarea($wp_customize, 'omega-footer', array('label' => esc_html__('Footer Text', 'omega'), 'section' => 'footer', 'settings' => "custom_footer"))); /* If viewing the customize preview screen, add a script to show a live preview. */ if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'omega_customize_preview_footer_script', 21); } }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @param object $wp_customize * @since Cakifo 1.4 */ function cakifo_customize_register($wp_customize) { /* Get the theme prefix. */ $prefix = hybrid_get_prefix(); /* Get the default theme settings. */ $defaults = hybrid_get_default_theme_settings(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; /* Add the Cakifo section */ $wp_customize->add_section('cakifo_customize_settings', array('title' => esc_html__('Cakifo settings', 'cakifo'), 'priority' => 35, 'capability' => 'edit_theme_options')); /** * Link color */ $wp_customize->add_setting("{$prefix}_theme_settings[link_color]", array('default' => cakifo_get_default_link_color(), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => esc_html__('Link Color', 'cakifo'), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[link_color]"))); /** * Show slider? */ $wp_customize->add_setting("{$prefix}_theme_settings[featured_show]", array('default' => false, 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('featured_show', array('settings' => "{$prefix}_theme_settings[featured_show]", 'label' => esc_html__('Show "Featured Content" slider?', 'cakifo'), 'section' => 'cakifo_customize_settings', 'type' => 'checkbox')); /** * Slider categories */ // Create category array foreach (get_categories() as $cat) { $categories[$cat->term_id] = $cat->name; } /* Add setting and control */ $wp_customize->add_setting("{$prefix}_theme_settings[featured_category]", array('default' => '', 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('featured_category', array('settings' => "{$prefix}_theme_settings[featured_category]", 'label' => esc_html__('Featured Category:', 'cakifo'), 'section' => 'cakifo_customize_settings', 'type' => 'select', 'choices' => $categories)); /** * Number of posts in the slider */ $wp_customize->add_setting("{$prefix}_theme_settings[featured_posts]", array('default' => 5, 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('featured_posts', array('settings' => "{$prefix}_theme_settings[featured_posts]", 'label' => esc_html__('Number of posts', 'cakifo'), 'section' => 'cakifo_customize_settings', 'type' => 'text')); if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'cakifo_customize_preview', 21); } }
/** * Registers custom sections, settings, and controls for the $wp_customize instance. * * @since 0.3.2 * @access private * @param object $wp_customize */ function omega_customize_css_register($wp_customize) { /* Add the section. */ $wp_customize->add_section('css', array('title' => esc_html__('CSS', 'omega'), 'priority' => 150, 'capability' => 'unfiltered_html')); /* Add the 'custom_css' setting. */ $wp_customize->add_setting("custom_css", array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'omega_custom_css_sanitize', 'transport' => 'postMessage')); /* Add the textarea control for the 'custom_css' setting. */ $wp_customize->add_control(new Omega_Customize_Control_Textarea($wp_customize, 'custom_css', array('label' => '', 'section' => 'css', 'placeholder' => '.classname { background: #fff;}', 'settings' => "custom_css"))); /* If viewing the customize preview screen, add a script to show a live preview. */ if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'omega_customize_preview_script', 22); } }
/** * Configure settings and controls for the Colors section. * * @since 1.0.0. * * @param object $wp_customize The global customizer object. * @param string $section The section name. * @return void */ function ttfmake_customizer_color($wp_customize, $section) { $priority = new TTFMAKE_Prioritizer(); $control_prefix = 'ttfmake_'; $setting_prefix = str_replace($control_prefix, '', $section); // Primary Color $setting_id = $setting_prefix . '-primary'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Primary Color', 'make'), 'priority' => $priority->add()))); // Secondary Color $setting_id = $setting_prefix . '-secondary'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Secondary Color', 'make'), 'priority' => $priority->add()))); // Text Color $setting_id = $setting_prefix . '-text'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Text Color', 'make'), 'priority' => $priority->add()))); // Detail Color $setting_id = $setting_prefix . '-detail'; $wp_customize->add_setting($setting_id, array('default' => ttfmake_get_default($setting_id), 'type' => 'theme_mod', 'sanitize_callback' => 'maybe_hash_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $control_prefix . $setting_id, array('settings' => $setting_id, 'section' => $section, 'label' => __('Detail Color', 'make'), 'priority' => $priority->add()))); }
/** * Register the marketpress specific customizer options. In our * case it is a simple color picker to set a specific * key color. * * @param object $wp_customize * @return void */ function helsinki_register_customizer_sections($wp_customize) { // add section for the color switch to set the key colors $enabled_key_color = apply_filters('helsinki_register_customizer_sections_key_color', TRUE); if ($enabled_key_color) { $wp_customize->add_section('colors', array('title' => __('Colors', 'helsinki'), 'priority' => 5)); $wp_customize->add_setting('key_color', array('default' => apply_filters('helsinki_customizer_default_key_color', '#0084cc'), 'transport' => 'refresh', 'sanitize_callback' => 'helsinki_sanitize_color')); $wp_customize->add_setting('footer_link_color', array('default' => apply_filters('helsinki_customizer_default_footer_link_color', '#d36037'), 'transport' => 'refresh', 'sanitize_callback' => 'helsinki_sanitize_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'key_color', array('label' => __('Key Color', 'helsinki'), 'description' => __('The key color is the main color of the website. Usually it is the color of the links, hovers and backgrounds.', 'helsinki'), 'section' => 'colors', 'settings' => 'key_color'))); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_link_color', array('label' => __('Footer Link Color', 'helsinki'), 'description' => __('This color is for the links in the footer area of the website.', 'helsinki'), 'section' => 'colors', 'settings' => 'footer_link_color'))); } // add section for the custom logo $enabled_logo = apply_filters('helsinki_register_customizer_sections_logo', TRUE); if ($enabled_logo) { $wp_customize->add_section('helsinki_logo_section', array('title' => __('Logo', 'helsinki'), 'priority' => 6, 'description' => __('Upload a logo which usually replaces the default site name and description in the header', 'helsinki'))); $wp_customize->add_setting('helsinki_logo', array('default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'helsinki_logo', array('label' => __('Logo', 'helsinki'), 'section' => 'helsinki_logo_section', 'settings' => 'helsinki_logo'))); } // adding a new section to the customizer $enabled_social_icons = apply_filters('helsinki_register_customizer_sections_social_icons', TRUE); if ($enabled_social_icons) { $wp_customize->add_section('social_icons_section', array('title' => __('Social Media Icons', 'helsinki'), 'description' => __('In this Section you can enter your Social-Media-Channels to show them in your Theme. To do so, add the URL to your profiles in the inputs below.', 'helsinki'), 'priority' => 7)); $settings = helsinki_get_social_medias(); if (!is_array($settings) || count($settings) < 1) { return; } foreach ($settings as $id => $setting) { $option_key = 'social_icons_section' . '[' . $id . ']'; // adding a new setting to the database $wp_customize->add_setting($id, array('default' => '', 'sanitize_callback' => 'esc_url_raw')); $control_args = array('label' => $setting['label'], 'section' => 'social_icons_section', 'settings' => $id); $control = new WP_Customize_Control($wp_customize, $option_key, $control_args); $wp_customize->add_control($control); } } }
/** * Register customizer panels, sections, settings, and controls. * * @since 1.0.0 * @access public * @param object $wp_customize * @return void */ function customize_background_control_customize_register_example($wp_customize) { // Add a custom background panel for testing. $wp_customize->add_section('custom_background_section', array('priority' => 5, 'title' => esc_html__('Custom Background Example', 'customizer-background-control'))); // Registers example_background settings $wp_customize->add_setting('example_background_image_url', array('sanitize_callback' => 'esc_url')); $wp_customize->add_setting('example_background_image_id', array('sanitize_callback' => 'absint')); $wp_customize->add_setting('example_background_repeat', array('default' => 'no-repeat', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_setting('example_background_size', array('default' => 'auto', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_setting('example_background_attach', array('default' => 'scroll', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_setting('example_background_position', array('default' => 'center-center', 'sanitize_callback' => 'sanitize_text_field')); // Registers example_background control $wp_customize->add_control(new Customize_Custom_Background_Control($wp_customize, 'example_background', array('label' => esc_html__('Example Background', 'customizer-background-control'), 'section' => 'custom_background_section', 'settings' => array('image_url' => 'example_background_image_url', 'image_id' => 'example_background_image_id', 'repeat' => 'example_background_repeat', 'size' => 'example_background_size', 'position' => 'example_background_position', 'attach' => 'example_background_attach')))); }