本文整理汇总了PHP中object::add_setting方法的典型用法代码示例。如果您正苦于以下问题:PHP object::add_setting方法的具体用法?PHP object::add_setting怎么用?PHP object::add_setting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::add_setting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* 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())));
}
示例2: currency_settings
/**
* 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')));
}
}
示例3: spine2_customize_register
/**
* 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);
}
}
示例4: customizations
/**
* 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'));
}
示例5: peacock_register_theme_customizer
/**
* 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'));
}
示例6: omega_customize_logo_register
/**
* 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")));
}
示例7: array
/**
* 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()));
}
示例8: customize_register
/**
* 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')));
}
示例9: register
/**
* 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')));
}
示例10: customizations
/**
* 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'));
}
示例11: customizations
/**
* 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'));
}
示例12: saga_customize_register
/**
* 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()));
}
示例13: customize_register
/**
* 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')));
}
示例14: customize_register
/**
* 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)));
}
示例15: zeepersonal_customize_register_general_settings
/**
* 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'))));
}