本文整理汇总了PHP中WP_Customize_Manager::get_setting方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::get_setting方法的具体用法?PHP WP_Customize_Manager::get_setting怎么用?PHP WP_Customize_Manager::get_setting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Customize_Manager
的用法示例。
在下文中一共展示了WP_Customize_Manager::get_setting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: honos_customize_register
/**
* Implement Theme Customizer additions and adjustments.
*
* @since Honos 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function honos_customize_register($wp_customize)
{
// Add custom description to Colors and Background sections.
$wp_customize->get_section('colors')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
$wp_customize->get_section('background_image')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
// Add postMessage support for site title and description.
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
// Rename the label to "Site Title Color" because this only affects the site title in this theme.
$wp_customize->get_control('header_textcolor')->label = esc_html__('Site Title Color', 'honos');
// Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
$wp_customize->get_control('display_header_text')->label = esc_html__('Display Site Title & Tagline', 'honos');
$wp_customize->get_section('header_image')->title = esc_html__('Logo', 'honos');
// Add Theme Options panel and configure settings inside it
$wp_customize->add_panel('honos_theme_options_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => esc_html__('Theme Options', 'honos'), 'description' => esc_html__('You can configure your theme settings here', 'honos')));
$wp_customize->add_section('honos_header_call_us', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Call us', 'honos'), 'description' => esc_html__('Here you\'re able to configure your header call us link.', 'honos'), 'panel' => 'honos_theme_options_panel'));
$wp_customize->add_setting('honos_header_call_us_text', array('default' => esc_html__('Call us:', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('honos_header_call_us_text', array('label' => esc_html__('Call us text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
$wp_customize->add_setting('honos_header_call_us_link', array('sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control('honos_header_call_us_link', array('label' => esc_html__('Call us link', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
$wp_customize->add_setting('honos_header_call_us_link_text', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('honos_header_call_us_link_text', array('label' => esc_html__('Call us link text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
// Consult
$wp_customize->add_section('honos_header_consult', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Consult', 'honos'), 'description' => esc_html__('Consult text at the header.', 'honos'), 'panel' => 'honos_theme_options_panel'));
$wp_customize->add_setting('honos_header_consult_text', array('default' => esc_html__('Request a free consultation', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('honos_header_consult_text', array('label' => esc_html__('Consult text', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
$wp_customize->add_setting('honos_header_consult_text_link', array('sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control('honos_header_consult_text_link', array('label' => esc_html__('Consult link', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
// Footer columns
$wp_customize->add_section('honos_footer_columns', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Footer columns', 'honos'), 'description' => esc_html__('Footer column count.', 'honos'), 'panel' => 'honos_theme_options_panel'));
$wp_customize->add_setting('honos_footer_column_count', array('default' => '4', 'sanitize_callback' => 'absint'));
$wp_customize->add_control('honos_footer_column_count', array('label' => esc_html__('Footer columns', 'honos'), 'section' => 'honos_footer_columns', 'type' => 'select', 'choices' => array('1' => esc_html__('1 column', 'honos'), '2' => esc_html__('2 columns', 'honos'), '3' => esc_html__('3 columns', 'honos'), '4' => esc_html__('4 columns', 'honos'))));
}
示例2: zorkish_customize_register
/**
Configure custom theme options.
@param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function zorkish_customize_register($wp_customize)
{
// Improve display of title, description, and header text color during preview
// https://developer.wordpress.org/themes/advanced-topics/customizer-api/#using-postmessage-for-improved-setting-previewing
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
// Add a custom Customizer section
$wp_customize->add_section('custom_favicon', array('title' => __('Favicon'), 'description' => __('Set up your site\'s favicon.'), 'panel' => '', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Create a setting + control for the site favicons setup
$wp_customize->add_setting('favicon_links', array('default' => ''));
$wp_customize->add_control('favicon_links', array('type' => 'textarea', 'priority' => 10, 'section' => 'custom_favicon', 'label' => __('Favicon Links'), 'description' => __('Add your favicon links here.'), 'input_attrs' => array('class' => 'my-custom-class-for-js', 'style' => 'border: 1px solid #900', 'placeholder' => __('Add your favicon links here.'))));
create_color_setting($wp_customize, 'header_color', 'Header Color', '#232323');
create_color_setting($wp_customize, 'footer_color', 'Footer Color', '#232323');
create_color_setting($wp_customize, 'header_byline_color', 'Byline Color', '#DDAE4F');
// Remember whether Jetpack Site Logo is present
$site_logo_active = function_exists('jetpack_the_site_logo');
// Add a section for site logo customization. This is in additions
// to whatever Jetpack might add (if installed).
$wp_customize->add_section('zorkish_logo_section', array('title' => __($site_logo_active ? 'Inner Logo' : 'Site Logo', 'zorkish'), 'priority' => 30, 'description' => $site_logo_active ? 'Specify a logo to use on inner pages' : 'Upload a logo to replace the default site name and description in the header'));
// If Jetpack isn't installed, display the custom logo uploader.
// ALSO display it if we have a 'zorkish-logo' theme mod, to handle
// the user adding a custom logo and later installing Jetpack.
if (!$site_logo_active || get_theme_mod('zorkish-logo')) {
$wp_customize->add_setting('zorkish_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'zorkish_logo', array('label' => __('Logo', 'zorkish'), 'section' => 'zorkish_logo_section', 'settings' => 'zorkish_logo')));
}
// Add a setting for the site's inner logo
$wp_customize->add_setting('zorkish_inner_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'zorkish_inner_logo', array('label' => __('Inner Logo', 'zorkish'), 'section' => 'zorkish_logo_section', 'settings' => 'zorkish_inner_logo')));
}
示例3: xsbf_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function xsbf_customize_register($wp_customize)
{
$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_textcolor')->transport = 'refresh';
}
示例4: simplicize_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function simplicize_customize_register($wp_customize)
{
// Set site name and description text to be previewed in real-time
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
// Set site title color to be previewed in real-time
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
// Site Title Section
$wp_customize->add_section('title_tagline', array('title' => __('Site Title, Tagline & Logo', 'simplicize'), 'priority' => 1));
//Logo Uploader
$wp_customize->add_setting('simplicize_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'simplicize_logo', array('label' => __('Logo', 'simplicize'), 'section' => 'title_tagline', 'settings' => 'simplicize_logo', 'priority' => 1)));
// Site Title Align
$wp_customize->add_setting('title_align', array('default' => 'center', 'sanitize_callback' => 'simplicize_sanitize_logo_align'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'title_align', array('type' => 'radio', 'label' => __('Title & Logo Alignment', 'simplicize'), 'section' => 'title_tagline', 'choices' => array('left' => __('Left Align', 'simplicize'), 'center' => __('Center Align', 'simplicize'), 'right' => __('Right Align', 'simplicize')), 'priority' => 60)));
//Layout
$wp_customize->add_section('simplicize_layout_section', array('title' => __('Layout', 'simplicize'), 'priority' => 104));
// Display Blog Author
$wp_customize->add_setting('display_author_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_author_blog', array('label' => __('Show Blog Author Link?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_author_blog', 'type' => 'checkbox', 'priority' => 60)));
// Display Blog Date
$wp_customize->add_setting('display_date_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_date_blog', array('label' => __('Show Blog Date?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_date_blog', 'type' => 'checkbox', 'priority' => 60)));
// Display Post Featured Image or Video
$wp_customize->add_setting('display_feature_post', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_feature_post', array('label' => __('Show Post Featured Images?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_feature_post', 'type' => 'checkbox', 'priority' => 80)));
}
示例5: adustus_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function adustus_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
$wp_customize->add_section('adustus_primary', array('title' => __('Adustus Basic Settings'), 'description' => __('Here is where you will be able to make simple changes to your site.'), 'priority' => 160));
$wp_customize->add_setting('adustus_excerpt', array('type' => 'theme_mod', 'default' => '55'));
$wp_customize->add_control('adustus_excerpt', array('label' => __('Excerpt Length'), 'section' => 'adustus_primary', 'settings' => 'adustus_excerpt', 'type' => 'text'));
$wp_customize->add_setting('adustus_bg_color', array('type' => 'theme_mod', 'default' => '#eeeeee'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'adustus_bg_color', array('label' => __('Background Color'), 'section' => 'adustus_primary', 'settings' => 'adustus_bg_color')));
$wp_customize->add_section('adustus_content', array('title' => __('Adustus Content Settings'), 'description' => __('Here is where you will be able to change the categories of specific homepage sections'), 'priority' => 170));
$categories = get_categories();
$cats = array();
$i = 0;
foreach ($categories as $category) {
if ($i == 0) {
$default = $category->slug;
$i++;
}
$cats[$category->slug] = $category->name;
}
$wp_customize->add_setting('adustus_featured_category1', array('type' => 'theme_mod', 'default' => $default));
$wp_customize->add_control('adustus_featured_category1', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category1'));
$wp_customize->add_setting('adustus_featured_category2', array('type' => 'theme_mod', 'default' => $default));
$wp_customize->add_control('adustus_featured_category2', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category2'));
}
示例6: twentyseventeen_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function twentyseventeen_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial('blogname', array('selector' => '.site-title a', 'render_callback' => 'twentyseventeen_customize_partial_blogname'));
$wp_customize->selective_refresh->add_partial('blogdescription', array('selector' => '.site-description', 'render_callback' => 'twentyseventeen_customize_partial_blogdescription'));
/**
* Custom colors.
*/
$wp_customize->add_setting('colorscheme', array('default' => 'light', 'transport' => 'postMessage', 'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme'));
$wp_customize->add_setting('colorscheme_hue', array('default' => 250, 'transport' => 'postMessage', 'sanitize_callback' => 'absint'));
$wp_customize->add_control('colorscheme', array('type' => 'radio', 'label' => __('Color Scheme', 'twentyseventeen'), 'choices' => array('light' => __('Light', 'twentyseventeen'), 'dark' => __('Dark', 'twentyseventeen'), 'custom' => __('Custom', 'twentyseventeen')), 'section' => 'colors', 'priority' => 5));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'colorscheme_hue', array('mode' => 'hue', 'section' => 'colors', 'priority' => 6)));
/**
* Theme options.
*/
$wp_customize->add_section('theme_options', array('title' => __('Theme Options', 'twentyseventeen'), 'priority' => 130));
$wp_customize->add_setting('page_layout', array('default' => 'two-column', 'sanitize_callback' => 'twentyseventeen_sanitize_page_layout', 'transport' => 'postMessage'));
$wp_customize->add_control('page_layout', array('label' => __('Page Layout', 'twentyseventeen'), 'section' => 'theme_options', 'type' => 'radio', 'description' => __('When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen'), 'choices' => array('one-column' => __('One Column', 'twentyseventeen'), 'two-column' => __('Two Column', 'twentyseventeen')), 'active_callback' => 'twentyseventeen_is_view_with_layout_option'));
/**
* Filter number of front page sections in Twenty Seventeen.
*
* @since Twenty Seventeen 1.0
*
* @param $num_sections integer
*/
$num_sections = apply_filters('twentyseventeen_front_page_sections', 4);
// Create a setting and control for each of the sections available in the theme.
for ($i = 1; $i < 1 + $num_sections; $i++) {
$wp_customize->add_setting('panel_' . $i, array('default' => false, 'sanitize_callback' => 'absint', 'transport' => 'postMessage'));
$wp_customize->add_control('panel_' . $i, array('label' => sprintf(__('Front Page Section %d Content', 'twentyseventeen'), $i), 'description' => 1 !== $i ? '' : __('Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen'), 'section' => 'theme_options', 'type' => 'dropdown-pages', 'allow_addition' => true, 'active_callback' => 'twentyseventeen_is_static_front_page'));
$wp_customize->selective_refresh->add_partial('panel_' . $i, array('selector' => '#panel' . $i, 'render_callback' => 'twentyseventeen_front_page_section', 'container_inclusive' => true));
}
}
示例7: register
/**
* This hooks into 'customize_register' (available as of WP 3.4) and allows
* you to add new sections and controls to the Theme Customize screen.
*
* Note: To enable instant preview, we have to actually write a bit of custom
* javascript. See live_preview() for more.
*
* @see add_action('customize_register',$func)
* @param \WP_Customize_Manager $wp_customize
* @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes
*/
public static function register($wp_customize)
{
//2. Register new settings to the WP database...
$wp_customize->add_setting('highlight_color', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
//3. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'mytheme_highlight_color', array('label' => __('Highlight Color', 'historias'), 'section' => 'colors', 'settings' => 'highlight_color', 'priority' => 10)));
$wp_customize->add_setting('site_logo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/images/setoriais_logo.png'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'upload_site_logo', array('label' => __('Site Logo', 'historias'), 'section' => 'title_tagline', 'settings' => 'site_logo', 'priority' => 10)));
$wp_customize->add_setting('site_tagline', array('default' => 'Eleição 2015', 'type' => 'option'));
$wp_customize->add_control('site_tagline', array('type' => 'textarea', 'section' => 'title_tagline', 'label' => __('Tagline', 'historias')));
//4. We can also change built-in settings by modifying properties. For instance, let's make some stuff use live preview JS...
$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('background_color')->transport = 'postMessage';
// $wp_customize->add_section('setorial_cnpc_logo_section', array(
// 'title' => __('Logo', 'setorial_cnpc'),
// 'description' => '',
// 'priority' => 40,
// ));
// $wp_customize->add_setting('setorial_cnpc_logo]', array(
// 'capability' => 'edit_theme_options',
// 'type' => 'theme_mod',
// 'default' => get_template_directory_uri() . '/images/setoriais_logo.png',
// ));
// $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'setorial_cnpc_logo', array(
// 'label' => __('Imagem da logo', 'setorial_cnpc'),
// 'section' => 'setorial_cnpc_logo_section',
// 'settings' => 'setorial_cnpc_logo',
// )));
}
示例8: twentyfourteen_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function twentyfourteen_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->add_setting('accent_color', array('default' => '#24890d', 'sanitize_callback' => 'twentyfourteen_generate_accent_colors'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => __('Accent Color', 'twentyfourteen'), 'section' => 'colors', 'settings' => 'accent_color')));
}
示例9: twentyfourteen_customize_register
/**
* Implement Customizer additions and adjustments.
*
* @since Twenty Fourteen 1.0
*
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
function twentyfourteen_customize_register($wp_customize)
{
// Add postMessage support for site title and description.
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
if (isset($wp_customize->selective_refresh)) {
$wp_customize->selective_refresh->add_partial('blogname', array('selector' => '.site-title a', 'container_inclusive' => false, 'render_callback' => 'twentyfourteen_customize_partial_blogname'));
$wp_customize->selective_refresh->add_partial('blogdescription', array('selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'twentyfourteen_customize_partial_blogdescription'));
}
// Rename the label to "Site Title Color" because this only affects the site title in this theme.
$wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'twentyfourteen');
// Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
$wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'twentyfourteen');
// Add custom description to Colors and Background controls or sections.
if (property_exists($wp_customize->get_control('background_color'), 'description')) {
$wp_customize->get_control('background_color')->description = __('May only be visible on wide screens.', 'twentyfourteen');
$wp_customize->get_control('background_image')->description = __('May only be visible on wide screens.', 'twentyfourteen');
} else {
$wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'twentyfourteen');
$wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'twentyfourteen');
}
// Add the featured content section in case it's not already there.
$wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'twentyfourteen'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen'), esc_url(add_query_arg('tag', _x('featured', 'featured content default tag slug', 'twentyfourteen'), admin_url('edit.php'))), admin_url('edit.php?show_sticky=1')), 'priority' => 130, 'active_callback' => 'is_front_page'));
// Add the featured content layout setting and control.
$wp_customize->add_setting('featured_content_layout', array('default' => 'grid', 'sanitize_callback' => 'twentyfourteen_sanitize_layout'));
$wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'twentyfourteen'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('grid' => __('Grid', 'twentyfourteen'), 'slider' => __('Slider', 'twentyfourteen'))));
}
示例10: dbx_paper_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function dbx_paper_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('sitelogo')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
示例11: hamburgercat_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function hamburgercat_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
//All our sections, settings, and controls will be added here
$wp_customize->add_setting('austeve_background_image');
$wp_customize->add_setting('austeve_background_opacity');
$wp_customize->add_setting('austeve_logo_image');
$wp_customize->add_setting('austeve_num_sidebars');
$wp_customize->add_setting('austeve_display_tagline');
$wp_customize->add_section('hamburgercat_bg_section', array('title' => __('Background', 'hamburgercat'), 'priority' => 30, 'description' => 'Upload a background image'));
$wp_customize->add_section('hamburgercat_images_section', array('title' => __('Images', 'hamburgercat'), 'priority' => 30, 'description' => 'Upload Images used in the theme here'));
//Number of sidebars
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'austeve_num_sidebars', array('label' => __('Rows of content:', 'hamburger_cat'), 'section' => 'static_front_page', 'settings' => 'austeve_num_sidebars', 'type' => 'select', 'choices' => array('0' => __('None'), '1' => __('1'), '2' => __('2'), '3' => __('3'), '4' => __('4'), '5' => __('5'), '6' => __('6'), '7' => __('7'), '8' => __('8'), '9' => __('9')))));
//Sidebar layouts
for ($l = 1; $l <= get_theme_mod('austeve_num_sidebars', 0); $l++) {
$wp_customize->add_setting('austeve_content_layout_' . $l, array('default' => '12', 'transport' => 'refresh'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'austeve_content_layout_' . $l, array('label' => __('Row ' . $l . ' layout', 'hamburger_cat'), 'section' => 'static_front_page', 'settings' => 'austeve_content_layout_' . $l, 'type' => 'text')));
}
//Background Image
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'austeve_background_image', array('label' => __('Image:', 'hamburgercat'), 'section' => 'hamburgercat_bg_section', 'settings' => 'austeve_background_image')));
//Background opacity
$wp_customize->add_control('austeve_background_opacity', array('label' => __('Opacity', 'hamburgercat'), 'section' => 'hamburgercat_bg_section', 'settings' => 'austeve_background_opacity', 'type' => 'text'));
//Display tagline
$wp_customize->add_control('austeve_display_tagline', array('label' => __('Display tagline', 'hamburgercat'), 'section' => 'title_tagline', 'settings' => 'austeve_display_tagline', 'type' => 'checkbox'));
//Logo
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'austeve_logo_image', array('label' => __('Logo:', 'hamburgercat'), 'section' => 'title_tagline', 'settings' => 'austeve_logo_image')));
}
示例12: aggression_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function aggression_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
/**
* Add Section Layout to the Customizer.
*/
$wp_customize->add_section('aggression-theme-options', array('title' => __('Theme Options', 'aggression'), 'capability' => 'edit_theme_options', 'description' => 'Edit Theme Options'));
/**
* Create Layout Setting.
*/
$wp_customize->add_setting('aggression_layout_settings', array('default' => 'full-width', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_layout_setting_sanitize', 'transport' => 'postMessage'));
/**
* Add Layout Controls.
*/
$wp_customize->add_control('aggression_layout_control', array('settings' => 'aggression_layout_settings', 'type' => 'radio', 'label' => __('Layout Options', 'aggression'), 'choices' => array('full-width' => __('Full Width (default)', 'aggression'), 'content-sidebar' => __('Content-Sidebar', 'aggression'), 'sidebar-content' => __('Sidebar-Content', 'aggression'), 'sidebar-content-sidebar' => __('Sidebar-Content-Sidebar', 'aggression'), 'content-sidebar-sidebar' => __('Content-Sidebar-Sidebar', 'aggression'), 'sidebar-sidebar-content' => __('Sidebar-Sidebar-Content', 'aggression')), 'section' => 'aggression-theme-options'));
/**
* Page Titles.
*/
$wp_customize->add_setting('aggression_page_titles_settings', array('default' => 'on', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_page_title_sanitize', 'transport' => 'postMessage'));
/**
* Page Titles Controls.
*/
$wp_customize->add_control('aggression_page_titles_control', array('settings' => 'aggression_page_titles_settings', 'type' => 'radio', 'label' => __('Page Titles', 'aggression'), 'choices' => array('on' => __('On (default)', 'aggression'), 'off' => __('Off', 'aggression')), 'section' => 'aggression-theme-options'));
}
示例13: undiscovered_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function undiscovered_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
// Logo upload
$wp_customize->add_section('undiscovered_logotype', array('title' => __('Logotype', 'undiscovered'), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name in the header'));
$wp_customize->add_setting('undiscovered_options[logotype]', array('capability' => 'edit_theme_options', 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logotype', array('label' => __('Logo', 'undiscovered'), 'section' => 'undiscovered_logotype', 'settings' => 'undiscovered_options[logotype]')));
// Fonts
$wp_customize->add_section('undiscovered_fonts', array('title' => __('Fonts', 'undiscovered'), 'priority' => 30, 'description' => 'Set main website font'));
$wp_customize->add_setting('undiscovered_options[font]', array('capability' => 'edit_theme_options', 'default' => 'Rokkit', 'type' => 'option'));
$wp_customize->add_control('font', array('settings' => 'undiscovered_options[font]', 'label' => __('Fonts', 'undiscovered'), 'section' => 'undiscovered_fonts', 'type' => 'select', 'choices' => array('Rokkitt' => 'Rokkitt', 'Kameron' => 'Kameron', 'Abel' => 'Abel', 'Alice' => 'Alice', 'Andada' => 'Andada', 'Arbutus+Slab' => 'Arbutus Slab', 'Arvo' => 'Arvo', 'Brawler' => 'Brawler', 'Cambo' => 'Cambo', 'Cookie' => 'Cookie', 'Droid+Serif' => 'Droid Serif', 'Fenix' => 'Fenix', 'Judson' => 'Judson', 'Ledger' => 'Ledger', 'Libre+Baskerville' => 'Libre Baskerville', 'Lora' => 'Lora', 'Mako' => 'Mako', 'Marck+Script' => 'Marck Script', 'Maven+Pro' => 'Maven Pro', 'Neuton' => 'Neuton', 'Ovo' => 'Ovo', 'PT+Serif+Caption' => 'PT Serif Caption')));
// Colors
$wp_customize->add_section('undiscovered_colors', array('title' => __('Colors', 'undiscovered'), 'priority' => 40));
// Primary
$wp_customize->add_setting('undiscovered_options[primary_color]', array('default' => 'e83d52', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[primary_color]')));
// Secondary
$wp_customize->add_setting('undiscovered_options[secondary_color]', array('default' => 'be3243', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary_color', array('label' => __('Secondary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[secondary_color]')));
// Social icons
$wp_customize->add_section('undiscovered_social', array('title' => __('Social icons', 'undiscovered'), 'priority' => 30, 'description' => 'Leave blank if don\'t needed'));
$networks = get_social_networks();
foreach ($networks as $network) {
$wp_customize->add_setting('undiscovered_options[social_' . strtolower($network) . ']', array('capability' => 'edit_theme_options', 'type' => 'option'));
$wp_customize->add_control('undiscovered_options[social_' . strtolower($network) . ']', array('label' => $network, 'section' => 'undiscovered_social', 'type' => 'text'));
}
}
示例14: everbox_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function everbox_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->add_section('everbox_general_section', array('title' => __('General', 'everbox')));
// Primary Color
$wp_customize->add_setting('everbox_primary_color', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_hex_color'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'everbox_primary_color', array('label' => __('Primary Color', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_primary_color')));
// Post excerpt length
$wp_customize->add_setting('everbox_excerpt_length', array('default' => 60, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_integer'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_excerpt_length', array('label' => __('Post excerpt length', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_excerpt_length', 'type' => 'number')));
// Cagetory link
$wp_customize->add_setting('everbox_category_link', array('default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_category_link', array('label' => __('Show cagetory link', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_category_link', 'type' => 'checkbox')));
// Infinite loading
$wp_customize->add_setting('everbox_infinite', array('default' => 0, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_infinite', array('label' => __('Infinite Pagination with jetpack', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_infinite', 'type' => 'checkbox')));
// Credit
$wp_customize->add_setting('everbox_credit', array('default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_credit', array('label' => __('Footer Credit', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_credit', 'type' => 'checkbox')));
$wp_customize->add_section('everbox_icons_section', array('title' => __('ICONS', 'everbox')));
// LOGO
$wp_customize->add_setting('everbox_logo', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_logo', array('label' => __('LOGO', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_logo')));
// favicon
$wp_customize->add_setting('everbox_favicon', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_favicon', array('label' => __('Favicon', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_favicon')));
// iPhone App icon
$wp_customize->add_setting('everbox_app', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_app', array('label' => __('iPhone Retina icon (sizes:120x120)', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_app')));
}
示例15: edin_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function edin_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
$wp_customize->add_section('edin_theme_options', array('title' => __('Theme Options', 'edin'), 'priority' => 130));
/* Menu Style */
$wp_customize->add_setting('edin_menu_style', array('default' => 'default', 'sanitize_callback' => 'edin_sanitize_menu_style'));
$wp_customize->add_control('edin_menu_style', array('label' => __('Menu Style', 'edin'), 'section' => 'edin_theme_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('default' => __('Default', 'edin'), 'classic' => __('Classic', 'edin'))));
/* Sidebar Position */
$wp_customize->add_setting('edin_sidebar_position', array('default' => 'right', 'sanitize_callback' => 'edin_sanitize_sidebar_position', 'transport' => 'postMessage'));
$wp_customize->add_control('edin_sidebar_position', array('label' => __('Sidebar Position', 'edin'), 'section' => 'edin_theme_options', 'priority' => 2, 'type' => 'radio', 'choices' => array('left' => __('Left', 'edin'), 'right' => __('Right', 'edin'))));
/* Thumbnail Aspect Ratio */
$wp_customize->add_setting('edin_thumbnail_style', array('default' => 'landscape', 'sanitize_callback' => 'edin_sanitize_thumbnail_style'));
$wp_customize->add_control('edin_thumbnail_style', array('label' => __('Thumbnail Aspect Ratio', 'edin'), 'section' => 'edin_theme_options', 'priority' => 3, 'type' => 'radio', 'choices' => array('landscape' => __('Landscape (4:3)', 'edin'), 'square' => __('Square (1:1)', 'edin'))));
/* Header: show breadcrumb navigation */
if (function_exists('jetpack_breadcrumbs')) {
$wp_customize->add_setting('edin_breadcrumbs', array('default' => '', 'sanitize_callback' => 'edin_sanitize_checkbox'));
$wp_customize->add_control('edin_breadcrumbs', array('label' => __('Pages: show breadcrumb navigation', 'edin'), 'section' => 'edin_theme_options', 'priority' => 4, 'type' => 'checkbox'));
}
/* Featured Image: Remove filter */
$wp_customize->add_setting('edin_featured_image_remove_filter', array('default' => '', 'sanitize_callback' => 'edin_sanitize_checkbox', 'transport' => 'postMessage'));
$wp_customize->add_control('edin_featured_image_remove_filter', array('label' => __('Featured Image: remove filter', 'edin'), 'section' => 'edin_theme_options', 'priority' => 5, 'type' => 'checkbox'));
/* Header: show search form */
$wp_customize->add_setting('edin_search_header', array('default' => '', 'sanitize_callback' => 'edin_sanitize_checkbox'));
$wp_customize->add_control('edin_search_header', array('label' => __('Header: show search form', 'edin'), 'section' => 'edin_theme_options', 'priority' => 6, 'type' => 'checkbox'));
/* Front Page: show title */
$wp_customize->add_setting('edin_title_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_checkbox'));
$wp_customize->add_control('edin_title_front_page', array('label' => __('Front Page: show title', 'edin'), 'section' => 'edin_theme_options', 'priority' => 7, 'type' => 'checkbox'));
/* Front Page: Featured Page One */
$wp_customize->add_setting('edin_featured_page_one_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_one_front_page', array('label' => __('Front Page: Featured Page One', 'edin'), 'section' => 'edin_theme_options', 'priority' => 8, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Two */
$wp_customize->add_setting('edin_featured_page_two_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_two_front_page', array('label' => __('Front Page: Featured Page Two', 'edin'), 'section' => 'edin_theme_options', 'priority' => 9, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Three */
$wp_customize->add_setting('edin_featured_page_three_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_three_front_page', array('label' => __('Front Page: Featured Page Three', 'edin'), 'section' => 'edin_theme_options', 'priority' => 10, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Four */
$wp_customize->add_setting('edin_featured_page_four_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_four_front_page', array('label' => __('Front Page: Featured Page Four', 'edin'), 'section' => 'edin_theme_options', 'priority' => 11, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Five */
$wp_customize->add_setting('edin_featured_page_five_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_five_front_page', array('label' => __('Front Page: Featured Page Five', 'edin'), 'section' => 'edin_theme_options', 'priority' => 12, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Six */
$wp_customize->add_setting('edin_featured_page_six_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_six_front_page', array('label' => __('Front Page: Featured Page Six', 'edin'), 'section' => 'edin_theme_options', 'priority' => 13, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Seven */
$wp_customize->add_setting('edin_featured_page_seven_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_seven_front_page', array('label' => __('Front Page: Featured Page Seven', 'edin'), 'section' => 'edin_theme_options', 'priority' => 14, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Eight */
$wp_customize->add_setting('edin_featured_page_eight_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_eight_front_page', array('label' => __('Front Page: Featured Page Eight', 'edin'), 'section' => 'edin_theme_options', 'priority' => 15, 'type' => 'dropdown-pages'));
/* Front Page: Featured Page Nine */
$wp_customize->add_setting('edin_featured_page_nine_front_page', array('default' => '', 'sanitize_callback' => 'edin_sanitize_dropdown_pages'));
$wp_customize->add_control('edin_featured_page_nine_front_page', array('label' => __('Front Page: Featured Page Nine', 'edin'), 'section' => 'edin_theme_options', 'priority' => 16, 'type' => 'dropdown-pages'));
/* Jetpack Testimonial */
$wp_customize->add_setting('edin_testimonials', array('default' => '', 'sanitize_callback' => 'edin_sanitize_checkbox'));
$wp_customize->add_control('edin_testimonials', array('label' => __('Show 2 random testimonials on the Front Page Template ', 'edin'), 'section' => 'jetpack_testimonials', 'priority' => 90, 'type' => 'checkbox'));
}