本文整理汇总了PHP中WP_Customize_Manager::get_section方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::get_section方法的具体用法?PHP WP_Customize_Manager::get_section怎么用?PHP WP_Customize_Manager::get_section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Customize_Manager
的用法示例。
在下文中一共展示了WP_Customize_Manager::get_section方法的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: 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'))));
}
示例3: longform_customize_register
/**
* Implement Theme Customizer additions and adjustments.
*
* @since Longform 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function longform_customize_register($wp_customize)
{
// Add custom description to Colors and Background sections.
$wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'longform');
$wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'longform');
// 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 = __('Site Title Color', 'longform');
// 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', 'longform');
// Add the featured content section in case it's not already there.
$wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'longform'), '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.', 'longform'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130));
// Add the featured content layout setting and control.
$wp_customize->add_setting('featured_content_layout', array('default' => 'slider', 'sanitize_callback' => 'longform_sanitize_layout'));
$wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'longform'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('slider' => __('Slider', 'longform'))));
// Add General setting panel and configure settings inside it
$wp_customize->add_panel('longform_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'longform'), 'description' => __('You can configure your general theme settings here', 'longform')));
// Website logo
$wp_customize->add_section('longform_general_logo', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Website logo', 'longform'), 'description' => __('Please upload your logo, recommended logo size should be between 262x80', 'longform'), 'panel' => 'longform_general_panel'));
$wp_customize->add_setting('longform_logo', array('sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_logo', array('label' => __('Website logo', 'longform'), 'section' => 'longform_general_logo', 'settings' => 'longform_logo')));
// Copyright
$wp_customize->add_section('longform_general_copyright', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Copyright', 'longform'), 'description' => __('Please provide short copyright text which will be shown in footer.', 'longform'), 'panel' => 'longform_general_panel'));
$wp_customize->add_setting('longform_copyright', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_copyright', array('label' => 'Copyright', 'section' => 'longform_general_copyright', 'type' => 'text'));
// Scroll to top
$wp_customize->add_section('longform_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'longform'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'longform'), 'panel' => 'longform_general_panel'));
$wp_customize->add_setting('longform_scrolltotop', array('sanitize_callback' => 'longform_sanitize_checkbox'));
$wp_customize->add_control('longform_scrolltotop', array('label' => 'Scroll to top', 'section' => 'longform_general_scrolltotop', 'type' => 'checkbox'));
// Favicon
$wp_customize->add_section('longform_general_favicon', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Favicon', 'longform'), 'description' => __('Do you have favicon? You can upload it here.', 'longform'), 'panel' => 'longform_general_panel'));
$wp_customize->add_setting('longform_favicon', array('sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_favicon', array('label' => __('Favicon', 'longform'), 'section' => 'longform_general_favicon', 'settings' => 'longform_favicon')));
// Page layout
$wp_customize->add_section('longform_general_layout', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Layout', 'longform'), 'description' => __('Choose a layout for your theme pages. Note that a widget has to be inside widget are, or the layout won\'t change.', 'longform'), 'panel' => 'longform_general_panel'));
$wp_customize->add_setting('longform_layout', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_layout', array('type' => 'radio', 'label' => 'Layout', 'section' => 'longform_general_layout', 'choices' => array('full' => 'Full', 'right' => 'Right')));
// Add Stories grid setting panel and configure settings inside it
$wp_customize->add_panel('longform_stories_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => __('Stories grid', 'longform'), 'description' => __('You can configure your themes stories grid here.', 'longform')));
// Grid tag
$wp_customize->add_section('longform_stories_tag', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Grid tag', 'longform'), 'description' => __('Please provide tag name of the posts which you want to show in "Stories grid" page.', 'longform'), 'panel' => 'longform_stories_panel'));
$wp_customize->add_setting('longform_stories_tag', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_stories_tag', array('label' => 'Grid tag', 'section' => 'longform_stories_tag', 'type' => 'text'));
// Stories per page
$wp_customize->add_section('longform_stories_perpage', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories per page', 'longform'), 'description' => __('How much stories should be showed per page?', 'longform'), 'panel' => 'longform_stories_panel'));
$wp_customize->add_setting('longform_stories_per_page', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_stories_per_page', array('label' => 'Stories per page', 'section' => 'longform_stories_perpage', 'type' => 'text'));
// Stories order
$wp_customize->add_section('longform_stories_order', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories order', 'longform'), 'description' => __('The order for stories page', 'longform'), 'panel' => 'longform_stories_panel'));
$wp_customize->add_setting('longform_stories_main_order', array('default' => 'ASC', 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_stories_main_order', array('label' => 'Stories order', 'section' => 'longform_stories_order', 'type' => 'select', 'choices' => array('ASC' => __('Ascending', 'longform'), 'DESC' => __('Descending', 'longform'))));
// Social links
$wp_customize->add_section(new longform_Customized_Section($wp_customize, 'longform_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
$wp_customize->add_setting('longform_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('longform_fake_field', array('label' => '', 'section' => 'longform_social_links', 'type' => 'text'));
}
示例4: tesseract_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function tesseract_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_panel('tesseract_general_options', array('priority' => 3, 'capability' => 'edit_theme_options', 'title' => 'General'));
$wp_customize->add_panel('tesseract_header_options', array('priority' => 4, 'capability' => 'edit_theme_options', 'title' => 'Header Options'));
$wp_customize->add_panel('tesseract_footer_options', array('priority' => 5, 'capability' => 'edit_theme_options', 'title' => 'Footer Options'));
$wp_customize->add_panel('tesseract_layout', array('priority' => 7, 'capability' => 'edit_theme_options', 'title' => 'Layout Options'));
$wp_customize->add_panel('tesseract_social', array('priority' => 8, 'capability' => 'edit_theme_options', 'title' => 'Social'));
$wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
$wp_customize->get_section('title_tagline')->priority = 3;
if ($wp_customize->get_section('static_front_page')) {
$wp_customize->get_section('static_front_page')->panel = 'tesseract_general_options';
$wp_customize->get_section('static_front_page')->priority = 4;
}
$wp_customize->get_section('background_image')->panel = 'tesseract_general_options';
$wp_customize->get_section('background_image')->priority = 2;
$wp_customize->get_section('colors')->panel = 'tesseract_general_options';
$wp_customize->get_section('colors')->title = __('Background Color', 'tesseract');
$wp_customize->get_section('colors')->priority = 1;
$wp_customize->get_control('background_color')->label = __('Choose a background color', 'tesseract');
$wp_customize->get_control('background_color')->description = __('(This is only for the site\'s generic background color. You can define header and footer background colors in the Header Options and Footer Options respectively.)', 'tesseract');
$wp_customize->remove_section('header_image');
$wp_customize->remove_section('nav');
$wp_customize->remove_control('header_textcolor');
require get_template_directory() . '/inc/sections/header-colors.php';
require get_template_directory() . '/inc/sections/header-logo.php';
require get_template_directory() . '/inc/sections/header-size.php';
require get_template_directory() . '/inc/sections/header-menu.php';
require get_template_directory() . '/inc/sections/header-content.php';
require get_template_directory() . '/inc/sections/mobile-menu.php';
require get_template_directory() . '/inc/sections/social/account01.php';
require get_template_directory() . '/inc/sections/social/account02.php';
require get_template_directory() . '/inc/sections/social/account03.php';
require get_template_directory() . '/inc/sections/social/account04.php';
require get_template_directory() . '/inc/sections/social/account05.php';
require get_template_directory() . '/inc/sections/social/account06.php';
require get_template_directory() . '/inc/sections/social/account07.php';
require get_template_directory() . '/inc/sections/social/account08.php';
require get_template_directory() . '/inc/sections/social/account09.php';
require get_template_directory() . '/inc/sections/social/account10.php';
require get_template_directory() . '/inc/sections/blog.php';
require get_template_directory() . '/inc/sections/search-results.php';
require get_template_directory() . '/inc/sections/footer-colors.php';
require get_template_directory() . '/inc/sections/footer-size.php';
require get_template_directory() . '/inc/sections/footer-logo.php';
require get_template_directory() . '/inc/sections/footer-content.php';
require get_template_directory() . '/inc/sections/woocommerce.php';
//if ( $wp_customize->is_preview() && ! is_admin() )
//add_action( 'wp_footer', 'tesseract_customize_preview', 21);
}
示例5: sgwindow_customize_register
/**
* Register postMessage support for site title and description for the Customizer.
*
* @param WP_Customize_Manager $wp_customize Customizer object.
* @since SG Window 1.0.0
*/
function sgwindow_customize_register($wp_customize)
{
$wp_customize->add_panel('background', array('priority' => 105, 'title' => __('Customize Background', 'sg-window'), 'description' => __('Background.', 'sg-window')));
$wp_customize->add_panel('navigation', array('priority' => 106, 'title' => __('Customize Menu', 'sg-window'), 'description' => __('Navigation settings.', 'sg-window')));
//Sets postMessage support
$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_section('colors')->panel = 'custom_colors';
$wp_customize->get_section('colors')->priority = '1';
$wp_customize->get_section('background_image')->panel = 'background';
$wp_customize->get_section('background_image')->priority = '10';
$wp_customize->get_section('background_image')->priority = '10';
}
示例6: boron_customize_register
/**
* Implement Theme Customizer additions and adjustments.
*
* @since Boron 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function boron_customize_register($wp_customize)
{
// Add custom description to Colors and Background sections.
$wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'boron');
$wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'boron');
// 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 = __('Site Title Color', 'boron');
// 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', 'boron');
// Add General setting panel and configure settings inside it
$wp_customize->add_panel('boron_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'boron'), 'description' => __('You can configure your general theme settings here', 'boron')));
// Add navigation setting panel and configure settings inside it
$wp_customize->add_panel('boron_navigation_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('Side navigation settings', 'boron'), 'description' => __('You can configure your theme side navigation settings here.', 'boron')));
// Scroll to top
$wp_customize->add_section('boron_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'boron'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'boron'), 'panel' => 'boron_general_panel'));
$wp_customize->add_setting('boron_scrolltotop', array('sanitize_callback' => 'boron_sanitize_checkbox'));
$wp_customize->add_control('boron_scrolltotop', array('label' => __('Scroll to top', 'boron'), 'section' => 'boron_general_scrolltotop', 'type' => 'checkbox'));
// Post background
$wp_customize->add_section('boron_post_bg', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Post background', 'boron'), 'description' => __('Do you want your own post background? You can change it here.', 'boron'), 'panel' => 'boron_general_panel'));
$wp_customize->add_setting('boron_post_background', array('sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_post_background', array('label' => __('Post background', 'boron'), 'section' => 'boron_post_bg', 'settings' => 'boron_post_background')));
// Comment position
$wp_customize->add_section('boron_post_comments', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post comments', 'boron'), 'description' => __('Choose where to show post comments.', 'boron'), 'panel' => 'boron_general_panel'));
$wp_customize->add_setting('boron_comment_location', array('default' => 'side', 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('boron_comment_location', array('label' => __('Post comments position', 'boron'), 'section' => 'boron_post_comments', 'type' => 'select', 'choices' => array('side' => 'Right side', 'bottom' => 'After post content')));
// Grid size
$wp_customize->add_section('boron_grid_size', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post grid size', 'boron'), 'description' => __('Choose how many columns will there be at the post grid.', 'boron'), 'panel' => 'boron_general_panel'));
$wp_customize->add_setting('boron_grid_columns', array('default' => '4', 'sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('boron_grid_columns', array('label' => __('Post grid size', 'boron'), 'section' => 'boron_grid_size', 'type' => 'select', 'choices' => array('2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6')));
// Background
$wp_customize->add_section('boron_navigation_bg', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Navigation background', 'boron'), 'description' => __('Do you want your own navigation background? You can change it here.', 'boron'), 'panel' => 'boron_navigation_panel'));
$wp_customize->add_setting('boron_navigation_background', array('sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() . '/images/navigation-bg.png'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_navigation_background', array('label' => __('Navigation background', 'boron'), 'section' => 'boron_navigation_bg', 'settings' => 'boron_navigation_background')));
// Navigation title
$wp_customize->add_section('boron_navigation_title', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Navigation title', 'boron'), 'description' => __('Title for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel'));
$wp_customize->add_setting('boron_nav_title', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('boron_nav_title', array('label' => __('Navigation title', 'boron'), 'section' => 'boron_navigation_title', 'type' => 'text'));
// Navigation description
$wp_customize->add_section('boron_navigation_description', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Navigation description', 'boron'), 'description' => __('Description for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel'));
$wp_customize->add_setting('boron_nav_description', array('sanitize_callback' => 'boron_sanitize_textarea'));
$wp_customize->add_control('boron_nav_description', array('label' => __('Navigation description', 'boron'), 'section' => 'boron_navigation_description', 'type' => 'textarea'));
// Social links
$wp_customize->add_section(new boron_Customized_Section($wp_customize, 'boron_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
$wp_customize->add_setting('boron_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('boron_fake_field', array('label' => '', 'section' => 'boron_social_links', 'type' => 'text'));
}
示例7: kt_customize_register
/**
* Add postMessage support for site title and description for the Customizer.
*
* @since Kute Theme 1.0
*
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
function kt_customize_register($wp_customize)
{
$color_scheme = kt_get_color_scheme();
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
// Add color scheme setting and control.
$wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'kt_sanitize_color_scheme', 'transport' => 'postMessage'));
$wp_customize->add_control('color_scheme', array('label' => esc_attr__('Base Color Scheme', 'kutetheme'), 'section' => 'colors', 'type' => 'select', 'choices' => kt_get_color_scheme_choices(), 'priority' => 1));
// Add custom header and sidebar text color setting and control.
$wp_customize->add_setting('main_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_color', array('label' => esc_attr__('Theme Color', 'kutetheme'), 'description' => esc_attr__('Applied to the theme color.', 'kutetheme'), 'section' => 'colors')));
// Remove the core header textcolor control, as it shares the sidebar text color.
$wp_customize->remove_control('header_textcolor');
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting('box_background_color', array('default' => $color_scheme[2], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'box_background_color', array('label' => esc_attr__('Box and Sidebar Background Color', 'kutetheme'), 'description' => esc_attr__('Applied to the box and sidebar color.', 'kutetheme'), 'section' => 'colors')));
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting('textcolor', array('default' => $color_scheme[3], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'textcolor', array('label' => esc_attr__('Text Color', 'kutetheme'), 'description' => esc_attr__('Applied to the text color', 'kutetheme'), 'section' => 'colors')));
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting('price_color', array('default' => $color_scheme[8], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'price_color', array('label' => esc_attr__('Price Color', 'kutetheme'), 'description' => esc_attr__('Applied to the price on wide screens.', 'kutetheme'), 'section' => 'colors')));
// Add an additional description to the header image section.
$wp_customize->get_section('header_image')->description = esc_attr__('Applied to the header on small screens and the sidebar on wide screens.', 'kutetheme');
}
示例8: setSection
/**
* Handle a section entry
*
* @param $id
* @param array $data
* @param array|null $settings
* @param $panel_id
*/
public function setSection($id, array $data, array $settings = null, $panel_id = null)
{
$section_data = $this->getSectionData($data, $panel_id);
if (is_null($panel_id) && isset($data['panel'])) {
$panel_id = $data['panel'];
}
if (is_null($settings) && isset($data['settings'])) {
$settings = $data['settings'];
}
$item = $this->customizer->get_section($id);
if ($item) {
foreach ($data as $var => $val) {
if (array_key_exists($var, $section_data)) {
$item->{$var} = $val;
}
if (!empty($panel_id)) {
$item->panel = $panel_id;
}
}
if (isset($data['delete']) && $data['delete'] === true) {
$this->customizer->remove_section($id);
}
} else {
$this->customizer->add_section(new WP_Customize_Section($this->customizer, $id, $section_data));
}
if (!is_null($settings)) {
$settings['object'] = 'settings';
$settings['section'] = $id;
$this->processData($settings);
}
}
示例9: itek_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function itek_customize_register($wp_customize)
{
// Add custom description to Title, Colors and Background sections.
$wp_customize->get_section('title_tagline')->description = __('Enabling the tagline will push content section down off the header image!.', 'itek');
$wp_customize->get_section('colors')->description = __('TITLE NOTE: Default color is only applied to Site Title! Background may only be visible on wide screens.', 'itek');
$wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'itek');
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->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 = __('Site Title & Tagline Color', 'itek');
// 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', 'itek');
$wp_customize->add_section('itek_general_options', array('title' => __('iTek General Options', 'itek'), 'description' => sprintf(__('Use the following settings to set Sitewide General options.', 'itek')), 'priority' => 31));
$wp_customize->add_section('itek_content_options', array('title' => __('iTek Content Options', 'itek'), 'description' => sprintf(__('Use the following settings to set Content Options.', 'itek')), 'priority' => 32));
// Add the featured content section in case it's not already there.
$wp_customize->add_section('itek_showcase_content', array('title' => __('iTek Showcase Options', 'itek'), 'description' => sprintf(__('Use this section for extra finer controls of your Showcase area!', 'itek')), 'priority' => 33));
$wp_customize->add_section('itek_fitvids_options', array('title' => __('iTek FitVids Options', 'itek'), 'description' => sprintf(__('Use the following settings to set fitvids script options. Options are: Enable script, Set selector (Default is .post) and set custom selector (optional) for other areas like .sidebar or a custom section!', 'itek')), 'priority' => 34));
$wp_customize->add_setting('itek_tagline_visibility', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_tagline_visibility', array('type' => 'checkbox', 'label' => __('Display Site Tagline', 'itek'), 'section' => 'title_tagline', 'priority' => 20));
$wp_customize->add_setting('itek_logo_image', array('default-image' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options'));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'tanzanite_logo', array('label' => __('Upload a logo', 'itek'), 'section' => 'title_tagline', 'priority' => 21, 'settings' => 'itek_logo_image')));
$wp_customize->add_setting('itek_headerimage_visibility', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_headerimage_visibility', array('type' => 'checkbox', 'label' => __('Display Header On All Pages', 'itek'), 'section' => 'header_image', 'priority' => 1));
// Begin General Options Section
if (class_exists('woocommerce')) {
$wp_customize->add_setting('itek_woo_menu_cart_visibility', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_woo_menu_cart_visibility', array('type' => 'checkbox', 'label' => __('Add Cart Link To Primary Menu', 'itek'), 'section' => 'itek_general_options', 'priority' => 1));
$wp_customize->add_setting('itek_woo_page_title_visibility', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_woo_page_title_visibility', array('type' => 'checkbox', 'label' => __('Hide WooCommerce Page Title', 'itek'), 'section' => 'itek_general_options', 'priority' => 2));
}
$wp_customize->add_setting('itek_page_title_visibility', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_page_title_visibility', array('type' => 'checkbox', 'label' => __('Hide Standard Page Title', 'itek'), 'section' => 'itek_content_options', 'priority' => 1));
$wp_customize->add_setting('itek_feed_excerpt_length', array('sanitize_callback' => 'itek_sanitize_integer', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_feed_excerpt_length', array('type' => 'text', 'default' => '85', 'label' => __('Blog Feed Excerpt Length', 'itek'), 'section' => 'itek_content_options', 'priority' => 2));
$wp_customize->add_setting('itek_recentpost_excerpt_length', array('sanitize_callback' => 'itek_sanitize_integer', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_recentpost_excerpt_length', array('type' => 'text', 'default' => '25', 'label' => __('Recent Post Widget Excerpt Length', 'itek'), 'section' => 'itek_content_options', 'priority' => 3));
// Showcase Options
$wp_customize->add_setting('itek_showcase_disable_morphing', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_showcase_disable_morphing', array('type' => 'checkbox', 'label' => __('Disable Showcase Image Morphing', 'itek'), 'section' => 'itek_showcase_content', 'priority' => 1));
// Add FitVids to site
$wp_customize->add_setting('itek_fitvids_enable', array('sanitize_callback' => 'itek_sanitize_checkbox', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_fitvids_enable', array('type' => 'checkbox', 'label' => __('Enable FitVids?', 'itek'), 'section' => 'itek_fitvids_options', 'priority' => 1));
$wp_customize->add_setting('itek_fitvids_selector', array('default' => '.post', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_fitvids_selector', array('label' => __('Enter a selector for FitVids - i.e. .post', 'itek'), 'section' => 'itek_fitvids_options', 'priority' => 2, 'type' => 'text'));
$wp_customize->add_setting('itek_fitvids_custom_selector', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
$wp_customize->add_control('itek_fitvids_custom_selector', array('label' => __('Enter a custom selector for FitVids - i.e. .sidebar', 'itek'), 'section' => 'itek_fitvids_options', 'priority' => 3, 'type' => 'text'));
}
示例10: padhang_customize_register
/**
* Add new controls and postMessage support for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function padhang_customize_register($wp_customize)
{
// require cusom customizer controls
require_once get_template_directory() . '/inc/customizer-controls.php';
// Rename Background Image section to Background
$wp_customize->get_section('background_image')->title = __('Background', 'padhang');
// Move Background Color to Background section
$wp_customize->get_control('background_color')->section = 'background_image';
/**
* General section
*/
$wp_customize->add_section('padhang_general_section', array('title' => __('General', 'padhang'), 'priority' => 10));
$wp_customize->add_setting('fonts_kit', array('default' => 'roboto', 'sanitize_callback' => 'padhang_sanitize_fontskit'));
$wp_customize->add_control('fonts_kit', array('label' => __('Fonts Kit', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'fonts_kit', 'type' => 'select', 'choices' => array('roboto' => 'Roboto + Roboto Slab', 'opensans' => 'Open Sans + Bitter')));
$wp_customize->add_setting('wrapper_width', array('default' => '96', 'sanitize_callback' => 'padhang_wrapper_width_sanitize'));
$wp_customize->add_control('wrapper_width', array('label' => __('Wrapper width (%)', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'wrapper_width', 'type' => 'text'));
$wp_customize->add_setting('footer_text', array('default' => '© 2014 <a href="' . esc_url(home_url('/')) . '">' . bloginfo('name') . '</a>', 'sanitize_callback' => 'wp_kses_data'));
$wp_customize->add_control(new Padhang_Customize_Textarea_Control($wp_customize, 'footer_text', array('label' => __('Footer text', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'footer_text')));
/**
* Title and Tagline section
*/
$wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'options_heading', array('section' => 'title_tagline', 'type' => 'heading', 'label' => __('Title and Tagline Options', 'padhang'))));
$wp_customize->add_setting('show_hide_title', array('default' => 1, 'sanitize_callback' => 'absint'));
$wp_customize->add_control('show_hide_title', array('label' => __('Show site title', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_title', 'type' => 'checkbox'));
$wp_customize->add_setting('show_hide_tagline', array('default' => 1, 'sanitize_callback' => 'absint'));
$wp_customize->add_control('show_hide_tagline', array('label' => __('Show site tagline', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_tagline', 'type' => 'checkbox'));
/**
* Logo section
*/
$wp_customize->add_section('padhang_logo_section', array('title' => __('Logo', 'padhang'), 'priority' => 30));
$wp_customize->add_setting('logo_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'logo_image', array('label' => __('Logo', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'logo_image', 'context' => 'padhang-logo-image')));
$wp_customize->add_setting('favicon_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
$wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'favicon_image', array('label' => __('Favicon', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'favicon_image', 'context' => 'padhang-favicon-image')));
/**
* Colors section
*/
$wp_customize->add_setting('site_title_color', array('default' => '#ffffff'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_title_color', array('label' => __('Title Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_title_color')));
$wp_customize->add_setting('site_tagline_color', array('default' => '#ffffff'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_tagline_color', array('label' => __('Tagline Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_tagline_color')));
$wp_customize->add_setting('accent_color', array('default' => '#65b045'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => __('Accent Color', 'padhang'), 'section' => 'colors', 'settings' => 'accent_color')));
$wp_customize->add_setting('overlay_color', array('default' => '#222222'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'overlay_color', array('label' => __('Overlay Color (%)', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_color')));
$wp_customize->add_setting('overlay_transparency', array('default' => '70', 'sanitize_callback' => 'padhang_transparency_sanitize'));
$wp_customize->add_control('overlay_transparency', array('label' => __('Overlay Transparency', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_transparency', 'type' => 'text'));
$wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'overlay_transparency_description', array('section' => 'colors', 'type' => 'text', 'description' => __('Set 0 to disable overlay.', 'padhang'))));
/**
* Background section
*/
$wp_customize->add_setting('background_cover', array('default' => 0, 'sanitize_callback' => 'absint'));
$wp_customize->add_control('background_cover', array('label' => __('Make background image covering the page', 'padhang'), 'section' => 'background_image', 'settings' => 'background_cover', 'type' => 'checkbox'));
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
}
示例11: beryl_customize_register
/**
* Implement Theme Customizer additions and adjustments.
*
* @since Beryl 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function beryl_customize_register($wp_customize)
{
// Add custom description to Colors and Background sections.
$wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'beryl');
$wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'beryl');
// 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 = __('Site Title Color', 'beryl');
// 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', 'beryl');
$wp_customize->get_section('header_image')->title = __('Logo', 'beryl');
// Social links
$wp_customize->add_section(new beryl_Customized_Section($wp_customize, 'beryl_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
$wp_customize->add_setting('beryl_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
$wp_customize->add_control('beryl_fake_field', array('label' => '', 'section' => 'beryl_social_links', 'type' => 'text'));
}
示例12: twentyfourteen_customize_register
/**
* Implement Theme Customizer additions and adjustments.
*
* @since Twenty Fourteen 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function twentyfourteen_customize_register($wp_customize)
{
// Add custom description to Colors and Background sections.
$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 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 = __('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 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'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130));
// 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'))));
}
示例13: HuI_customize_register
/**
* Add postMessage support for site title and description for the Customizer.
*
* @since Twenty Fifteen 1.0
*
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
function HuI_customize_register($wp_customize)
{
$color_scheme = HuI_get_color_scheme();
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting('blog_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_background_color', array('label' => __('blog Background Color', 'HuI'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'HuI'), 'section' => 'colors')));
// Add an additional description to the header image section.
$wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'HuI');
}
示例14: array
/**
* Test the customize_register method.
*
* @see WP_Customize_Nav_Menus::customize_register()
*/
function test_customize_register()
{
do_action('customize_register', $this->wp_customize);
$menu_id = wp_create_nav_menu('Primary');
$post_id = self::factory()->post->create(array('post_title' => 'Hello World'));
$item_id = wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'post_type', 'menu-item-object' => 'post', 'menu-item-object-id' => $post_id, 'menu-item-title' => 'Hello World', 'menu-item-status' => 'publish'));
$setting = new WP_Customize_Nav_Menu_Item_Setting($this->wp_customize, "nav_menu_item[{$item_id}]");
do_action('customize_register', $this->wp_customize);
$this->assertEquals('Primary', $this->wp_customize->get_section("nav_menu[{$menu_id}]")->title);
$this->assertEquals('Hello World', $this->wp_customize->get_control("nav_menu_item[{$item_id}]")->label);
}
示例15: check_capabilities
/**
* Check if the theme supports the control and check user capabilities.
*
* @since 3.4.0
*
* @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true.
*/
public final function check_capabilities()
{
foreach ($this->settings as $setting) {
//if ( ! $setting->check_capabilities() )
// return false;
}
$section = $this->manager->get_section($this->section);
if (isset($section) && !$section->check_capabilities()) {
return false;
}
return true;
}