get_control() public method

Retrieve a customize control.
Since: 3.4.0
public get_control ( string $id ) : WP_Customize_Control | void
$id string ID of the control.
return WP_Customize_Control | void The control object, if set.
Ejemplo n.º 1
2
/**
 * Implement Theme Customizer additions and adjustments.
 * Static front page priority is 120, so we assign our section priorities higher
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function bigblank_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';
    // 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', 'bigblank');
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $defaults = bigblank_get_default_theme_options();
    // Contact Section
    $wp_customize->add_section('contact', array('title' => __('Contact Settings', 'bigblank'), 'priority' => 140));
    // phone text
    $wp_customize->add_setting('bigblank_theme_options[phone]', array('type' => 'option', 'default' => $defaults['phone']));
    $wp_customize->add_control('bigblank_theme_options[phone]', array('label' => __('Phone Number', 'bigblank'), 'section' => 'contact', 'settings' => 'bigblank_theme_options[phone]'));
    // address text
    $wp_customize->add_setting('bigblank_theme_options[address]', array('type' => 'option', 'default' => $defaults['address']));
    $wp_customize->add_control('bigblank_theme_options[address]', array('label' => __('Address', 'bigblank'), 'section' => 'contact', 'settings' => 'bigblank_theme_options[address]'));
    // social section
    $wp_customize->add_section('social', array('title' => __('Social Links', 'bigblank'), 'priority' => 150));
    // twitter
    $wp_customize->add_setting('bigblank_theme_options[twitter]', array('type' => 'option', 'default' => $defaults['twitter']));
    $wp_customize->add_control('bigblank_theme_options[twitter]', array('label' => __('Twitter', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[twitter]'));
    // facebook
    $wp_customize->add_setting('bigblank_theme_options[facebook]', array('type' => 'option', 'default' => $defaults['facebook']));
    $wp_customize->add_control('bigblank_theme_options[facebook]', array('label' => __('Facebook', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[facebook]'));
    // google+
    $wp_customize->add_setting('bigblank_theme_options[googleplus]', array('type' => 'option', 'default' => $defaults['googleplus']));
    $wp_customize->add_control('bigblank_theme_options[googleplus]', array('label' => __('Google+', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[googleplus]'));
    // instagram
    $wp_customize->add_setting('bigblank_theme_options[instagram]', array('type' => 'option', 'default' => $defaults['instagram']));
    $wp_customize->add_control('bigblank_theme_options[instagram]', array('label' => __('Instagram', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[instagram]'));
    // youtube
    $wp_customize->add_setting('bigblank_theme_options[youtube]', array('type' => 'option', 'default' => $defaults['youtube']));
    $wp_customize->add_control('bigblank_theme_options[youtube]', array('label' => __('Youtube', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[youtube]'));
    // pinterest
    $wp_customize->add_setting('bigblank_theme_options[pinterest]', array('type' => 'option', 'default' => $defaults['pinterest']));
    $wp_customize->add_control('bigblank_theme_options[pinterest]', array('label' => __('Pinterest', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[pinterest]'));
    // Default Layout
    $wp_customize->add_section('bigblank_layout', array('title' => __('Layout', 'bigblank'), 'priority' => 130));
    $wp_customize->add_setting('bigblank_theme_options[theme_layout]', array('type' => 'option', 'default' => $defaults['theme_layout'], 'sanitize_callback' => 'sanitize_key'));
    $layouts = bigblank_layouts();
    $choices = array();
    foreach ($layouts as $layout) {
        $choices[$layout['value']] = $layout['label'];
    }
    $wp_customize->add_control('bigblank_theme_options[theme_layout]', array('section' => 'bigblank_layout', 'type' => 'radio', 'choices' => $choices));
    // Footer Section
    $wp_customize->add_section('footer', array('title' => __('Footer Settings', 'bigblank'), 'priority' => 160));
    // copyright text
    $wp_customize->add_setting('bigblank_theme_options[footer_copyright]', array('type' => 'option', 'default' => $defaults['footer_copyright']));
    $wp_customize->add_control('bigblank_theme_options[footer_copyright]', array('label' => __('Copyright Text', 'bigblank'), 'section' => 'footer', 'settings' => 'bigblank_theme_options[footer_copyright]'));
    // footer text
    $wp_customize->add_setting('bigblank_theme_options[footer_text]', array('type' => 'option', 'default' => $defaults['footer_text']));
    $wp_customize->add_control('bigblank_theme_options[footer_text]', array('label' => __('Footer Text', 'bigblank'), 'section' => 'footer', 'settings' => 'bigblank_theme_options[footer_text]'));
}
Ejemplo n.º 2
1
/**
 * 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'))));
}
Ejemplo n.º 3
1
/**
 * 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);
}
/**
 * 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'))));
}
Ejemplo n.º 5
0
/**
 * 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 &amp; 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'));
}
/**
 * Register postMessage support.
 *
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @since Tiny Framework 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function tinyframework_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';
    // 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', 'tinyframework');
    // 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 &amp; Tagline', 'tinyframework');
}
Ejemplo n.º 7
0
/**
 * 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 &amp; 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'));
}
Ejemplo n.º 8
0
/**
 * 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'));
}
 /**
  * Handle a control entry
  *
  * @param $id
  * @param $section_id
  * @param array $data
  * @throws \ErrorException If the `control_class` can not be found
  */
 public function setControl($id, $section_id, array $data)
 {
     $control_data = $this->getControlData($id, $section_id, $data);
     if (is_null($section_id) && isset($data['section'])) {
         $section_id = $data['section'];
     }
     $item = $this->customizer->get_control($id);
     if ($item) {
         foreach ($data as $var => $val) {
             if (array_key_exists($var, $control_data)) {
                 $item->{$var} = $val;
             } elseif ($var == 'control_type') {
                 $item->type = $val;
             }
         }
         if (!is_null($section_id)) {
             $item->section = $section_id;
         }
         if (isset($data['delete']) && $data['delete'] === true) {
             $this->customizer->remove_control($id);
         }
     } else {
         if (!isset($data['control_type'])) {
             $data['control_type'] = 'text';
         }
         $cls = isset($data['control_class']) ? $data['control_class'] : null;
         if (is_null($cls)) {
             switch ($data['control_type']) {
                 case 'select':
                     $cls = 'WP_Customize_Control';
                     foreach ($data['choices'] as $var => $val) {
                         $data['choices'][$var] = __($val, 'basicbootstrap');
                     }
                     break;
                 case 'checkbox':
                     $cls = 'WP_Customize_Control';
                     if (!isset($data['sanitize_callback'])) {
                         $data['sanitize_callback'] = 'sanitize_checkbox';
                     }
                     break;
                 case 'color':
                     $cls = 'WP_Customize_Color_Control';
                     if (!isset($data['sanitize_callback'])) {
                         $data['sanitize_callback'] = 'sanitize_hex_color';
                     }
                     break;
                 default:
                     $cls = 'WP_Customize_Control';
                     break;
             }
         }
         if (!class_exists($cls)) {
             throw new ErrorException(sprintf('Customizer control class "%s" not found!', $cls));
         }
         $this->customizer->add_control(new $cls($this->customizer, $id, $control_data));
     }
 }
 /**
  * Registers the icon background setting in the Customizer. It is shown right below the Site Icon setting.
  *
  * @since 0.1.0
  * @param WP_Customize_Manager $wp_customize action argument passed by WordPress
  */
 public function customize_register_background($wp_customize)
 {
     $site_icon_control = $wp_customize->get_control('site_icon');
     if (!$site_icon_control) {
         return;
     }
     $wp_customize->add_setting('wpsie_background_color', array('type' => 'option', 'capability' => 'manage_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wpsie_background_color', array('label' => __('Site Icon Background Color', 'site-icon-extended'), 'description' => __('The background color for the site icon is used across several Microsoft devices.', 'site-icon-extended'), 'section' => $site_icon_control->section, 'priority' => $site_icon_control->priority + 1)));
 }
Ejemplo n.º 11
0
/**
 * 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' => '&copy; 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';
}
Ejemplo n.º 12
0
/**
 * 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 &amp; 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'))));
}
Ejemplo n.º 13
0
/**
 * 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 &amp; 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'));
}
/**
 * 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_social', array('priority' => 9999, 'capability' => 'edit_theme_options', 'title' => 'Social'));
    $wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
    $wp_customize->get_section('title_tagline')->priority = 3;
    $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/logo.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/social/facebook.php';
    require get_template_directory() . '/inc/sections/social/twitter.php';
    require get_template_directory() . '/inc/sections/social/googleplus.php';
    require get_template_directory() . '/inc/sections/social/linkedin.php';
    require get_template_directory() . '/inc/sections/social/youtube.php';
    require get_template_directory() . '/inc/sections/social/vimeo.php';
    require get_template_directory() . '/inc/sections/social/tumblr.php';
    require get_template_directory() . '/inc/sections/social/flickr.php';
    require get_template_directory() . '/inc/sections/social/pinterest.php';
    require get_template_directory() . '/inc/sections/social/dribbble.php';
    require get_template_directory() . '/inc/sections/footer-colors.php';
    require get_template_directory() . '/inc/sections/footer-content.php';
    if ($wp_customize->is_preview() && !is_admin()) {
        add_action('wp_footer', 'tesseract_customize_preview', 21);
    }
}
Ejemplo n.º 15
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function cover_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->add_setting('cover_header_color', array('default' => '#026ed2', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_setting('cover_link_color', array('default' => '#026ed2', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_setting('cover_overlay_color', array('default' => 'overlay-dark', 'sanitize_callback' => 'cover_sanitize_overlay_color'));
    $wp_customize->add_setting('cover_show_featured_image', array('default' => false, 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_setting('cover_list_style', array('default' => 'minimal', 'sanitize_callback' => 'cover_sanitize_list_style'));
    $wp_customize->add_setting('cover_number_of_columns', array('default' => 1, 'sanitize_callback' => 'cover_sanitize_number_of_columns'));
    $wp_customize->add_section('cover_section_view', array('title' => __('Cover View Options', 'cover')));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'cover_header_color', array('label' => __('Header Color', 'cover'), 'section' => 'colors', 'settings' => 'cover_header_color')));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'cover_link_color', array('label' => __('Link Color', 'cover'), 'section' => 'colors', 'settings' => 'cover_link_color')));
    $wp_customize->add_control('cover_overlay_color', array('type' => 'select', 'label' => __('Overlay Color', 'cover'), 'section' => 'colors', 'choices' => array('overlay-dark' => 'Dark', 'overlay-light' => 'Light')));
    $wp_customize->add_control('cover_list_style', array('type' => 'select', 'label' => __('Post Listing Style', 'cover'), 'section' => 'cover_section_view', 'choices' => array('minimal' => 'Minimal', 'grid' => 'Card')));
    $wp_customize->add_control('cover_number_of_columns', array('type' => 'select', 'label' => __('Columns', 'cover'), 'description' => 'Applied when Cover View Options -> Post Listing Style is set to Grid.', 'section' => 'cover_section_view', 'choices' => array(1 => '1', 2 => '2', 3 => '3')));
    $wp_customize->add_control('cover_show_featured_image', array('type' => 'checkbox', 'label' => __('Show Featured Image', 'cover'), 'section' => 'cover_section_view'));
    $wp_customize->get_control('background_color')->description = __('Applied when Cover View Options -> Post Listing Style is set to Grid.', 'cover');
    $wp_customize->get_control('background_image')->description = __('Applied when Cover View Options -> Post Listing Style is set to Grid.', 'cover');
}
Ejemplo n.º 16
0
 /**
  * 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);
 }
 /**
  * @ticket 38164
  */
 function test_dropdown_pages()
 {
     do_action('customize_register', $this->wp_customize);
     $this->assertInstanceOf('WP_Customize_Nav_Menus', $this->wp_customize->nav_menus);
     $nav_menus_created_posts_setting = $this->wp_customize->get_setting('nav_menus_created_posts');
     $this->assertInstanceOf('WP_Customize_Filter_Setting', $nav_menus_created_posts_setting);
     $page_on_front_control = $this->wp_customize->get_control('page_on_front');
     // Ensure the add-new-toggle is absent if allow_addition param is not set.
     $page_on_front_control->allow_addition = false;
     ob_start();
     $page_on_front_control->maybe_render();
     $content = ob_get_clean();
     $this->assertNotContains('add-new-toggle', $content);
     // Ensure the add-new-toggle is absent if allow_addition param is set.
     $page_on_front_control->allow_addition = true;
     ob_start();
     $page_on_front_control->maybe_render();
     $content = ob_get_clean();
     $this->assertContains('add-new-toggle', $content);
     // Ensure that dropdown-pages delect is rendered even if there are no pages published (yet).
     foreach (get_pages() as $page) {
         wp_delete_post($page->ID);
     }
     $page_on_front_control->allow_addition = true;
     ob_start();
     $page_on_front_control->maybe_render();
     $content = ob_get_clean();
     $this->assertContains('<option value="0">', $content, 'Dropdown-pages renders select even without any pages published.');
     // Ensure that auto-draft pages are included if they are among the nav_menus_created_posts.
     $auto_draft_page_id = $this->factory()->post->create(array('post_type' => 'page', 'post_status' => 'auto-draft', 'post_title' => 'Auto Draft Page'));
     $this->factory()->post->create(array('post_type' => 'page', 'post_status' => 'auto-draft', 'post_title' => 'Orphan Auto Draft Page'));
     $auto_draft_post_id = $this->factory()->post->create(array('post_type' => 'post', 'post_status' => 'auto-draft', 'post_title' => 'Auto Draft Post'));
     $this->wp_customize->set_post_value($nav_menus_created_posts_setting->id, array($auto_draft_page_id, $auto_draft_post_id));
     $nav_menus_created_posts_setting->preview();
     ob_start();
     $page_on_front_control->maybe_render();
     $content = ob_get_clean();
     $this->assertContains(sprintf('<option value="%d">Auto Draft Page</option>', $auto_draft_page_id), $content);
     $this->assertNotContains('Auto Draft Post', $content);
     $this->assertNotContains('Orphan Auto Draft Page', $content);
 }
Ejemplo n.º 18
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function cyanotype_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('background_color')->transport = 'postMessage';
    $wp_customize->get_setting('background_image')->transport = 'postMessage';
    $wp_customize->get_setting('background_repeat')->transport = 'postMessage';
    $wp_customize->get_setting('background_position_x')->transport = 'postMessage';
    $wp_customize->get_setting('background_attachment')->transport = 'postMessage';
    // Add custom description to controls or sections.
    $wp_customize->get_control('blogdescription')->description = __('Tagline is hidden in this theme.', 'cyanotype');
}
Ejemplo n.º 19
0
 /**
  * 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'));
     do_action('customize_register', $this->wp_customize);
     $this->assertInstanceOf('WP_Customize_Nav_Menu_Item_Setting', $this->wp_customize->get_setting("nav_menu_item[{$item_id}]"));
     $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);
     $nav_menus_created_posts_setting = $this->wp_customize->get_setting('nav_menus_created_posts');
     $this->assertInstanceOf('WP_Customize_Filter_Setting', $nav_menus_created_posts_setting);
     $this->assertEquals('postMessage', $nav_menus_created_posts_setting->transport);
     $this->assertEquals(array(), $nav_menus_created_posts_setting->default);
     $this->assertEquals(array($this->wp_customize->nav_menus, 'sanitize_nav_menus_created_posts'), $nav_menus_created_posts_setting->sanitize_callback);
 }
 /**
  * Register Customizer settings and controls for the given widget IDs.
  *
  * @param array $register_widget_ids
  */
 function customize_register_widgets($register_widget_ids)
 {
     global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
     $new_setting_ids = array();
     $sidebars_widgets = wp_get_sidebars_widgets();
     foreach ($register_widget_ids as $widget_id) {
         $setting_id = $this->manager->widgets->get_setting_id($widget_id);
         if (!$this->manager->get_setting($setting_id)) {
             $setting_class = 'WP_Customize_Setting';
             // This will likely get filtered to WP_Customize_Widget_Setting.
             $setting_args = $this->manager->widgets->get_setting_args($setting_id);
             /** This filter is documented in wp-includes/class-wp-customize-manager.php */
             $setting_args = apply_filters('customize_dynamic_setting_args', $setting_args, $setting_id);
             /** This filter is documented in wp-includes/class-wp-customize-manager.php */
             $setting_class = apply_filters('customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args);
             $setting = new $setting_class($this->manager, $setting_id, $setting_args);
             $this->manager->add_setting($setting);
             $new_setting_ids[] = $setting_id;
         }
     }
     // Add a control for each active widget (located in a sidebar).
     foreach ($sidebars_widgets as $sidebar_id => $sidebar_widget_ids) {
         if (empty($sidebar_widget_ids) || !isset($wp_registered_sidebars[$sidebar_id])) {
             continue;
         }
         foreach ($sidebar_widget_ids as $i => $widget_id) {
             $setting_id = $this->manager->widgets->get_setting_id($widget_id);
             $should_register = in_array($widget_id, $register_widget_ids) && isset($wp_registered_widgets[$widget_id]) && !$this->manager->get_control($setting_id);
             if (!$should_register) {
                 continue;
             }
             $registered_widget = $wp_registered_widgets[$widget_id];
             $id_base = $wp_registered_widget_controls[$widget_id]['id_base'];
             $control = new \WP_Widget_Form_Customize_Control($this->manager, $setting_id, array('label' => $registered_widget['name'], 'section' => sprintf('sidebar-widgets-%s', $sidebar_id), 'sidebar_id' => $sidebar_id, 'widget_id' => $widget_id, 'widget_id_base' => $id_base, 'priority' => $i, 'width' => $wp_registered_widget_controls[$widget_id]['width'], 'height' => $wp_registered_widget_controls[$widget_id]['height'], 'is_wide' => $this->manager->widgets->is_wide_widget($widget_id)));
             $this->manager->add_control($control);
         }
     }
     if (!$this->manager->doing_ajax('customize_save')) {
         foreach ($new_setting_ids as $new_setting_id) {
             $this->manager->get_setting($new_setting_id)->preview();
         }
     }
 }
Ejemplo n.º 21
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function afterlight_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('background_color')->transport = 'postMessage';
    $wp_customize->get_setting('background_image')->transport = 'postMessage';
    $wp_customize->get_setting('background_repeat')->transport = 'postMessage';
    $wp_customize->get_setting('background_position_x')->transport = 'postMessage';
    $wp_customize->get_setting('background_attachment')->transport = 'postMessage';
    // Add custom description to controls or sections.
    $wp_customize->get_control('blogdescription')->description = __('Tagline is hidden in this theme.', 'afterlight');
    // Add Theme section.
    $wp_customize->add_section('afterlight_theme_options', array('title' => __('Theme', 'afterlight'), 'priority' => 200));
    // Add custom background overlay option setting and control.
    $wp_customize->add_setting('afterlight_background_overlay', array('default' => '1', 'transport' => 'postMessage', 'sanitize_callback' => 'afterlight_sanitize_checkbox'));
    $wp_customize->add_control('afterlight_background_overlay', array('label' => __('Add an overlay to background.', 'afterlight'), 'section' => 'afterlight_theme_options', 'visibility' => 'background_image', 'theme_supports' => 'custom-background', 'type' => 'checkbox', 'priority' => 1));
    // Add custom full page background image option setting and control.
    $wp_customize->add_setting('afterlight_full_page_background', array('default' => '1', 'transport' => 'postMessage', 'sanitize_callback' => 'afterlight_sanitize_checkbox'));
    $wp_customize->add_control('afterlight_full_page_background', array('label' => __('Scale background image to fit.', 'afterlight'), 'section' => 'afterlight_theme_options', 'visibility' => 'background_image', 'theme_supports' => 'custom-background', 'type' => 'checkbox', 'priority' => 2));
}
Ejemplo n.º 22
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function parallax_one_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 DEFAULT CONTROLS  ********************/
    /********************************************************/
    $wp_customize->remove_control('background_color');
    $wp_customize->get_section('background_image')->panel = 'panel_2';
    $wp_customize->get_section('colors')->panel = 'panel_2';
    /********************************************************/
    /********************* APPEARANCE  **********************/
    /********************************************************/
    $wp_customize->add_panel('panel_2', array('priority' => 30, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__('Appearance', 'parallax-one')));
    $wp_customize->add_setting('parallax_one_text_color', array('default' => '#313131', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'parallax_one_text_color', array('label' => esc_html__('Text color', 'parallax-one'), 'section' => 'colors', 'priority' => 5)));
    $wp_customize->add_setting('parallax_one_title_color', array('default' => '#454545', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'parallax_one_title_color', array('label' => esc_html__('Title color', 'parallax-one'), 'section' => 'colors', 'priority' => 6)));
    $wp_customize->add_section('parallax_one_appearance_general', array('title' => esc_html__('General options', 'parallax-one'), 'priority' => 3, 'description' => esc_html__('Paralax One theme general appearance options', 'parallax-one'), 'panel' => 'panel_2'));
    /* Logo	*/
    $wp_customize->add_setting('paralax_one_logo', array('default' => parallax_get_file('/images/logo-nav.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_logo', array('label' => esc_html__('Logo', 'parallax-one'), 'section' => 'parallax_one_appearance_general', 'priority' => 1)));
    /* Sticky header */
    $wp_customize->add_setting('paralax_one_sticky_header', array('sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('paralax_one_sticky_header', array('type' => 'checkbox', 'label' => esc_html__('Header visibility', 'parallax-one'), 'description' => esc_html__('If this box is checked, the header will toggle on frontpage.', 'parallax-one'), 'section' => 'parallax_one_appearance_general', 'priority' => 2));
    /********************************************************/
    /************* HEADER OPTIONS  ********************/
    /********************************************************/
    $wp_customize->add_panel('panel_1', array('priority' => 31, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__('Header section', 'parallax-one')));
    /* HEADER CONTENT */
    $wp_customize->add_section('parallax_one_header_content', array('title' => esc_html__('Content', 'parallax-one'), 'priority' => 1, 'panel' => 'panel_1'));
    /* Header Logo	*/
    $wp_customize->add_setting('paralax_one_header_logo', array('default' => parallax_get_file('/images/logo-2.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_header_logo', array('label' => esc_html__('Header Logo', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1)));
    /* Header title */
    $wp_customize->add_setting('parallax_one_header_title', array('default' => esc_html__('Simple, Reliable and Awesome.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Header subtitle */
    $wp_customize->add_setting('parallax_one_header_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3));
    /*Header Button text*/
    $wp_customize->add_setting('parallax_one_header_button_text', array('default' => esc_html__('GET STARTED', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_button_text', array('label' => esc_html__('Button label', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 4));
    $wp_customize->add_setting('parallax_one_header_button_link', array('default' => esc_html__('#', 'parallax-one'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_button_link', array('label' => esc_html__('Button link', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 5));
    /* LOGOS SETTINGS */
    $wp_customize->add_section('parallax_one_logos_settings_section', array('title' => esc_html__('Logos Bar', 'parallax-one'), 'priority' => 2, 'panel' => 'panel_1'));
    require_once 'class/parallax-one-general-control.php';
    $wp_customize->add_setting('parallax_one_logos_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array("image_url" => parallax_get_file('/images/companies/7.png'), "link" => "#"), array("image_url" => parallax_get_file('/images/companies/9.png'), "link" => "#"), array("image_url" => parallax_get_file('/images/companies/8.png'), "link" => "#")))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_logos_content', array('label' => esc_html__('Add new social icon', 'parallax-one'), 'section' => 'parallax_one_logos_settings_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1, 'parallax_image_control' => true, 'parallax_icon_control' => false, 'parallax_text_control' => false, 'parallax_link_control' => true)));
    $wp_customize->get_section('header_image')->panel = 'panel_1';
    /********************************************************/
    /****************** SERVICES OPTIONS  *******************/
    /********************************************************/
    /* SERVICES SECTION */
    $wp_customize->add_section('parallax_one_services_section', array('title' => esc_html__('Services section', 'parallax-one'), 'priority' => 32));
    /* Services title */
    $wp_customize->add_setting('parallax_one_our_services_title', array('default' => esc_html__('Our Services', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_services_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Services subtitle */
    $wp_customize->add_setting('parallax_one_our_services_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_services_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Services content */
    $wp_customize->add_setting('parallax_one_services_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('choice' => 'parallax_icon', 'icon_value' => 'icon-basic-webpage-multiple', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one')), array('choice' => 'parallax_icon', 'icon_value' => 'icon-ecommerce-graph3', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one')), array('choice' => 'parallax_icon', 'icon_value' => 'icon-basic-geolocalize-05', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_services_content', array('label' => esc_html__('Add new service box', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_icon_control' => true, 'parallax_title_control' => true, 'parallax_text_control' => true)));
    /********************************************************/
    /******************** ABOUT OPTIONS  ********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_about_section', array('title' => esc_html__('About section', 'parallax-one'), 'priority' => 33));
    /* About title */
    $wp_customize->add_setting('parallax_one_our_story_title', array('default' => esc_html__('Our Story', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_story_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* About Content */
    $wp_customize->add_setting('parallax_one_our_story_text', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_html', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_story_text', array('type' => 'textarea', 'label' => esc_html__('Content', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* About Image	*/
    $wp_customize->add_setting('paralax_one_our_story_image', array('default' => parallax_get_file('/images/about-us.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_our_story_image', array('label' => esc_html__('Image', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3)));
    /********************************************************/
    /*******************  TEAM OPTIONS  *********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_team_section', array('title' => esc_html__('Team section', 'parallax-one'), 'priority' => 34));
    /* Team title */
    $wp_customize->add_setting('parallax_one_our_team_title', array('default' => esc_html__('Our Team', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_team_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Team subtitle */
    $wp_customize->add_setting('parallax_one_our_team_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_team_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Team content */
    $wp_customize->add_setting('parallax_one_team_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('image_url' => parallax_get_file('/images/team/1.jpg'), 'title' => esc_html__('Albert Jacobs', 'parallax-one'), 'subtitle' => esc_html__('Founder & CEO', 'parallax-one')), array('image_url' => parallax_get_file('/images/team/2.jpg'), 'title' => esc_html__('Tonya Garcia', 'parallax-one'), 'subtitle' => esc_html__('Account Manager', 'parallax-one')), array('image_url' => parallax_get_file('/images/team/3.jpg'), 'title' => esc_html__('Linda Guthrie', 'parallax-one'), 'subtitle' => esc_html__('Business Development', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_team_content', array('label' => esc_html__('Add new team member', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_title_control' => true, 'parallax_subtitle_control' => true)));
    /********************************************************/
    /********** TESTIMONIALS OPTIONS  ***********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_testimonials_section', array('title' => esc_html__('Testimonial section', 'parallax-one'), 'priority' => 35));
    /* Testimonials title */
    $wp_customize->add_setting('parallax_one_happy_customers_title', array('default' => esc_html__('Happy Customers', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_happy_customers_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Testimonials subtitle */
    $wp_customize->add_setting('parallax_one_happy_customers_subtitle', array('default' => esc_html__('Cloud computing subscription model out of the box proactive solution.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_happy_customers_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Testimonials content */
    $wp_customize->add_setting('parallax_one_testimonials_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('image_url' => parallax_get_file('/images/clients/1.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one')), array('image_url' => parallax_get_file('/images/clients/2.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one')), array('image_url' => parallax_get_file('/images/clients/3.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_testimonials_content', array('label' => esc_html__('Add new testimonial', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_title_control' => true, 'parallax_subtitle_control' => true, 'parallax_text_control' => true)));
    /********************************************************/
    /***************** RIBBON OPTIONS  *****************/
    /********************************************************/
    /* RIBBON SETTINGS */
    $wp_customize->add_section('parallax_one_ribbon_section', array('title' => esc_html__('Ribbon section', 'parallax-one'), 'priority' => 36));
    /* Ribbon Background	*/
    $wp_customize->add_setting('paralax_one_ribbon_background', array('default' => parallax_get_file('/images/background-images/parallax-img/parallax-img1.jpg'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_ribbon_background', array('label' => esc_html__('Ribbon Background', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1)));
    $wp_customize->add_setting('parallax_one_ribbon_title', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_ribbon_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    $wp_customize->add_setting('parallax_one_button_text', array('default' => esc_html__('GET STARTED', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_button_text', array('label' => esc_html__('Button label', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3));
    $wp_customize->add_setting('parallax_one_button_link', array('default' => esc_html__('#', 'parallax-one'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_button_link', array('label' => esc_html__('Button link', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 4));
    /********************************************************/
    /************ LATEST NEWS OPTIONS  **************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_latest_news_section', array('title' => esc_html__('Latest news section', 'parallax-one'), 'priority' => 36));
    $wp_customize->add_setting('parallax_one_latest_news_title', array('default' => esc_html__('Latest news', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_latest_news_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_latest_news_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /********************************************************/
    /****************** CONTACT OPTIONS  ********************/
    /********************************************************/
    /* CONTACT SETTINGS */
    $wp_customize->add_section('parallax_one_contact_section', array('title' => esc_html__('Contact section', 'parallax-one'), 'priority' => 37));
    $wp_customize->add_setting('parallax_one_contact_info_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array("icon_value" => "icon-basic-mail", "text" => "*****@*****.**", "link" => "#"), array("icon_value" => "icon-basic-geolocalize-01", "text" => "Company address", "link" => "#"), array("icon_value" => "icon-basic-tablet", "text" => "0 332 548 954", "link" => "#")))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_contact_info_content', array('label' => esc_html__('Add new contact field', 'parallax-one'), 'section' => 'parallax_one_contact_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1, 'parallax_image_control' => false, 'parallax_icon_control' => true, 'parallax_text_control' => true, 'parallax_link_control' => true)));
    /* Map ShortCode  */
    $wp_customize->add_setting('parallax_one_frontpage_map_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_frontpage_map_shortcode', array('label' => esc_html__('Map shortcode', 'parallax-one'), 'description' => __('To use this section please install <a href="https://wordpress.org/plugins/intergeo-maps/">Intergeo Maps</a> plugin then use it to create a map and paste here the shortcode generated', 'parallax-one'), 'section' => 'parallax_one_contact_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /********************************************************/
    /*************** CONTACT PAGE OPTIONS  ******************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_contact_page', array('title' => esc_html__('Contact page', 'parallax-one'), 'priority' => 39));
    /* Contact Form  */
    $wp_customize->add_setting('parallax_one_contact_form_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_contact_form_shortcode', array('label' => esc_html__('Contact form shortcode', 'parallax-one'), 'description' => __('Create a form, copy the shortcode generated and paste it here. We recommend <a href="https://wordpress.org/plugins/contact-form-7/">Contact Form 7</a> but you can use any plugin you like.', 'parallax-one'), 'section' => 'parallax_one_contact_page', 'active_callback' => 'parallax_one_is_contact_page', 'priority' => 1));
    /* Map ShortCode  */
    $wp_customize->add_setting('parallax_one_contact_map_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_contact_map_shortcode', array('label' => esc_html__('Map shortcode', 'parallax-one'), 'description' => __('To use this section please install <a href="https://wordpress.org/plugins/intergeo-maps/">Intergeo Maps</a> plugin then use it to create a map and paste here the shortcode generated', 'parallax-one'), 'section' => 'parallax_one_contact_page', 'active_callback' => 'parallax_one_is_contact_page', 'priority' => 2));
    /********************************************************/
    /****************** FOOTER OPTIONS  *********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_footer_section', array('title' => esc_html__('Footer options', 'parallax-one'), 'priority' => 39, 'description' => esc_html__('The main content of this section is customizable in: Customize -> Widgets -> Footer area. ', 'parallax-one')));
    /* Footer Menu */
    $nav_menu_locations_footer = $wp_customize->get_control('nav_menu_locations[parallax_footer_menu]');
    if (!empty($nav_menu_locations_footer)) {
        $nav_menu_locations_footer->section = 'parallax_one_footer_section';
        $nav_menu_locations_footer->priority = 1;
    }
    /* Copyright */
    $wp_customize->add_setting('parallax_one_copyright', array('default' => 'Themeisle', 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_copyright', array('label' => esc_html__('Copyright', 'parallax-one'), 'section' => 'parallax_one_footer_section', 'priority' => 2));
    /* Socials icons */
    $wp_customize->add_setting('parallax_one_social_icons', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('icon_value' => 'icon-social-facebook', 'link' => '#'), array('icon_value' => 'icon-social-twitter', 'link' => '#'), array('icon_value' => 'icon-social-googleplus', 'link' => '#')))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_social_icons', array('label' => esc_html__('Add new social icon', 'parallax-one'), 'section' => 'parallax_one_footer_section', 'priority' => 3, 'parallax_image_control' => false, 'parallax_icon_control' => true, 'parallax_text_control' => false, 'parallax_link_control' => true)));
    /********************************************************/
    /************** ADVANCED OPTIONS  ***********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_general_section', array('title' => esc_html__('Advanced options', 'parallax-one'), 'priority' => 40, 'description' => esc_html__('Paralax One theme general options', 'parallax-one')));
    $blogname = $wp_customize->get_control('blogname');
    $blogdescription = $wp_customize->get_control('blogdescription');
    $show_on_front = $wp_customize->get_control('show_on_front');
    $page_on_front = $wp_customize->get_control('page_on_front');
    $page_for_posts = $wp_customize->get_control('page_for_posts');
    if (!empty($blogname)) {
        $blogname->section = 'parallax_one_general_section';
        $blogname->priority = 1;
    }
    if (!empty($blogdescription)) {
        $blogdescription->section = 'parallax_one_general_section';
        $blogdescription->priority = 2;
    }
    if (!empty($show_on_front)) {
        $show_on_front->section = 'parallax_one_general_section';
        $show_on_front->priority = 3;
    }
    if (!empty($page_on_front)) {
        $page_on_front->section = 'parallax_one_general_section';
        $page_on_front->priority = 4;
    }
    if (!empty($page_for_posts)) {
        $page_for_posts->section = 'parallax_one_general_section';
        $page_for_posts->priority = 5;
    }
    $wp_customize->remove_section('static_front_page');
    $wp_customize->remove_section('title_tagline');
    $nav_menu_locations_primary = $wp_customize->get_control('nav_menu_locations[primary]');
    if (!empty($nav_menu_locations_primary)) {
        $nav_menu_locations_primary->section = 'parallax_one_general_section';
        $nav_menu_locations_primary->priority = 6;
    }
    /* Disable preloader */
    $wp_customize->add_setting('paralax_one_disable_preloader', array('sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('paralax_one_disable_preloader', array('type' => 'checkbox', 'label' => esc_html__('Disable preloader?', 'parallax-one'), 'description' => esc_html__('If this box is checked, the preloader will be disabled from homepage.', 'parallax-one'), 'section' => 'parallax_one_general_section', 'priority' => 7));
}
 /**
  * Register Customizer settings and controls.
  *
  * @since 2.0.0
  *
  * @param WP_Customize_Manager $wp_customize Customizer manager instance.
  */
 public function customize_register($wp_customize)
 {
     $wp_customize->get_control('blogname')->priority = 7;
     // Add a setting to hide header text if the theme doesn't support the feature itself.
     if (!current_theme_supports('custom-header')) {
         $wp_customize->add_setting('site_logo_header_text', array('default' => 1, 'sanitize_callback' => array($this, 'sanitize_checkbox'), 'transport' => 'postMessage'));
         $wp_customize->add_control('cedaro_site_logo_header_text', array('label' => __('Display Header Text', 'huesos'), 'section' => 'title_tagline', 'settings' => 'site_logo_header_text', 'type' => 'checkbox', 'priority' => 12));
     }
     // Add a setting to sync the logo attachment properties.
     $wp_customize->add_setting('site_logo', array('capability' => 'manage_options', 'sanitize_callback' => array($this, 'sanitize_logo'), 'transport' => 'postMessage', 'type' => 'option', 'default' => array('id' => 0, 'url' => '')));
     // Add the setting for the image control.
     $wp_customize->add_setting('cedaro_site_logo_url', array('capability' => 'manage_options', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'postMessage', 'type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'cedaro_site_logo', array('label' => __('Site Logo', 'huesos'), 'section' => 'title_tagline', 'settings' => 'cedaro_site_logo_url', 'priority' => 4)));
 }
Ejemplo n.º 24
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function moscow_customize_register($wp_customize)
{
    $wp_customize->get_section('title_tagline')->priority = '9';
    $wp_customize->get_section('header_image')->panel = 'moscow_header_panel';
    $wp_customize->get_section('header_image')->priority = '12';
    $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_control('background_color')->priority = '11';
    $wp_customize->remove_setting('header_textcolor');
    $default_bulletin_background = get_template_directory_uri() . "/img/default-bulletin-background.jpg";
    // Titles
    class Moscow_Info extends WP_Customize_Control
    {
        public $type = 'info';
        public $label = '';
        public function render_content()
        {
            ?>
				<p style="margin-top:30px;border:1px solid;padding:5px;color:#333;text-transform:uppercase;font-weight:600;"><?php 
            echo esc_html($this->label);
            ?>
</p>
		<?php 
        }
    }
    /* HEADER AREA PANEL
    	------------------------------*/
    $wp_customize->add_panel('moscow_header_panel', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Header Area', 'moscow')));
    /* HEADER TYPE
    	------------------------------*/
    $wp_customize->add_section('moscow_header_type', array('title' => __('Header Type', 'moscow'), 'priority' => 10, 'panel' => 'moscow_header_panel', 'description' => __('You can select your header type from here. After that, continue below to the next tab "Header Bulletin" and configure it.', 'moscow')));
    // Front page header type
    $wp_customize->add_setting('front_header_type', array('default' => 'bulletin', 'sanitize_callback' => 'moscow_sanitize_header'));
    $wp_customize->add_control('front_header_type', array('type' => 'radio', 'label' => __('Front page header type', 'moscow'), 'section' => 'moscow_header_type', 'description' => __('Select the header type for your front page', 'moscow'), 'choices' => array('bulletin' => __('Bulletin', 'moscow'), 'image' => __('Image', 'moscow'), 'nothing' => __('Nothing (only menu)', 'moscow'))));
    // Site header type
    $wp_customize->add_setting('site_header_type', array('default' => 'image', 'sanitize_callback' => 'moscow_sanitize_header'));
    $wp_customize->add_control('site_header_type', array('type' => 'radio', 'label' => __('Site header type', 'moscow'), 'section' => 'moscow_header_type', 'description' => __('Select the header type for all pages except the front page', 'moscow'), 'choices' => array('bulletin' => __('Bulletin', 'moscow'), 'image' => __('Image', 'moscow'), 'nothing' => __('Nothing (only menu)', 'moscow'))));
    /* HEADER BULLETIN
    	------------------------------*/
    $wp_customize->add_section('moscow_bulletin', array('title' => __('Header Bulletin', 'moscow'), 'description' => __('You can add a background image to the bulletin. Make sure you select where to display your bulletin from the "Header Type" tab found above. You can also add a button or two (scroll down to find the options).', 'moscow'), 'priority' => 11, 'panel' => 'moscow_header_panel'));
    // Bulletin height
    $wp_customize->add_setting('bulletin_height', array('sanitize_callback' => 'absint', 'default' => '60'));
    $wp_customize->add_control('bulletin_height', array('type' => 'number', 'priority' => 12, 'section' => 'moscow_bulletin', 'label' => __('Bulletin height (% of window height) [default: 60%]', 'moscow'), 'input_attrs' => array('min' => 5, 'max' => 100, 'step' => 5)));
    // Bulletin background image
    $wp_customize->add_setting('moscow_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new Moscow_Info($wp_customize, 'bulletin_background_label', array('label' => __('Background', 'moscow'), 'section' => 'moscow_bulletin', 'settings' => 'moscow_options[info]', 'priority' => 13)));
    $wp_customize->add_setting('bulletin_image', array('sanitize_callback' => 'esc_url_raw', 'default' => $default_bulletin_background));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bulletin_image', array('label' => __('Bulletin background image', 'moscow'), 'type' => 'image', 'section' => 'moscow_bulletin', 'settings' => 'bulletin_image', 'priority' => 14)));
    // Bulletin background size
    $wp_customize->add_setting('bulletin_bg_size', array('default' => 'cover', 'sanitize_callback' => 'moscow_sanitize_bg_size'));
    $wp_customize->add_control('bulletin_bg_size', array('type' => 'radio', 'priority' => 15, 'label' => __('Bulletin background size', 'moscow'), 'section' => 'moscow_bulletin', 'choices' => array('cover' => __('Cover', 'moscow'), 'contain' => __('Contain', 'moscow'), 'auto' => __('Auto', 'moscow'))));
    // Bulletin background repeat
    $wp_customize->add_setting('bulletin_bg_repeat', array('default' => 'no-repeat', 'sanitize_callback' => 'moscow_sanitize_bg_repeat'));
    $wp_customize->add_control('bulletin_bg_repeat', array('type' => 'radio', 'priority' => 16, 'label' => __('Bulletin background repeat', 'moscow'), 'section' => 'moscow_bulletin', 'choices' => array('no-repeat' => __('No Repeat', 'moscow'), 'repeat' => __('Repeat', 'moscow'), 'repeat-x' => __('Repeat-X', 'moscow'), 'repeat-y' => __('Repeat-Y', 'moscow'))));
    // Title
    $wp_customize->add_setting('moscow_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new Moscow_Info($wp_customize, 'bulletin_title_label', array('label' => __('Title', 'moscow'), 'section' => 'moscow_bulletin', 'settings' => 'moscow_options[info]', 'priority' => 17)));
    $wp_customize->add_setting('bulletin_title', array('default' => __('Welcome to moscow', 'moscow'), 'sanitize_callback' => 'moscow_sanitize_text'));
    $wp_customize->add_control('bulletin_title', array('label' => __('Title for bulletin', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 18));
    // Subtitle
    $wp_customize->add_setting('bulletin_subtitle', array('default' => __('Feel free to look around', 'moscow'), 'sanitize_callback' => 'moscow_sanitize_text'));
    $wp_customize->add_control('bulletin_subtitle', array('label' => __('Subtitle for bulletin', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 19));
    // Bulletin button
    $wp_customize->add_setting('moscow_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new Moscow_Info($wp_customize, 'bulletin_button_label', array('label' => __('Button', 'moscow'), 'section' => 'moscow_bulletin', 'settings' => 'moscow_options[info]', 'priority' => 20)));
    // Button 1
    $wp_customize->add_setting('bulletin_button_1_text', array('default' => __('Click to begin', 'moscow'), 'sanitize_callback' => 'moscow_sanitize_text'));
    $wp_customize->add_control('bulletin_button_1_text', array('label' => __('Button 1 text', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 21));
    $wp_customize->add_setting('bulletin_button_1_url', array('default' => '#', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('bulletin_button_1_url', array('label' => __('Button 1 URL', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 22));
    // Button 2
    $wp_customize->add_setting('bulletin_button_2_text', array('default' => __('Click to begin', 'moscow'), 'sanitize_callback' => 'moscow_sanitize_text'));
    $wp_customize->add_control('bulletin_button_2_text', array('label' => __('Button 2 text', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 23));
    $wp_customize->add_setting('bulletin_button_2_url', array('default' => '#', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('bulletin_button_2_url', array('label' => __('Button 2 URL', 'moscow'), 'section' => 'moscow_bulletin', 'type' => 'text', 'priority' => 24));
    /* HEADER IMAGE
    	------------------------------*/
    // Header background size
    $wp_customize->add_setting('header_bg_size', array('default' => 'cover', 'sanitize_callback' => 'moscow_sanitize_bg_size'));
    $wp_customize->add_control('header_bg_size', array('type' => 'radio', 'priority' => 10, 'label' => __('Header background size', 'moscow'), 'section' => 'header_image', 'choices' => array('cover' => __('Cover', 'moscow'), 'contain' => __('Contain', 'moscow'), 'auto' => __('Auto', 'moscow'))));
    // Header background repeat
    $wp_customize->add_setting('header_bg_repeat', array('default' => 'no-repeat', 'sanitize_callback' => 'moscow_sanitize_bg_repeat'));
    $wp_customize->add_control('header_bg_repeat', array('type' => 'radio', 'priority' => 11, 'label' => __('Header background repeat', 'moscow'), 'section' => 'header_image', 'choices' => array('no-repeat' => __('No Repeat', 'moscow'), 'repeat' => __('Repeat', 'moscow'), 'repeat-x' => __('Repeat-X', 'moscow'), 'repeat-y' => __('Repeat-Y', 'moscow'))));
    // Header height
    $wp_customize->add_setting('header_height', array('sanitize_callback' => 'absint', 'default' => '20'));
    $wp_customize->add_control('header_height', array('type' => 'number', 'priority' => 12, 'section' => 'header_image', 'label' => __('Header height (% of window height) [default: 20%]', 'moscow'), 'input_attrs' => array('min' => 5, 'max' => 100, 'step' => 5)));
    /* COLORS
    	------------------------------*/
    // Primary color
    $wp_customize->add_setting('primary_color', array('default' => '#E62B1E', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary color', 'moscow'), 'section' => 'colors', 'settings' => 'primary_color', 'priority' => 10)));
    // Quiet link color
    $wp_customize->add_setting('quiet_link_color', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'quiet_link_color', array('label' => __('Quiet link color', 'moscow'), 'section' => 'colors', 'settings' => 'quiet_link_color', 'priority' => 12)));
    // Bulletin text color
    $wp_customize->add_setting('bulletin_text_color', array('default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bulletin_text_color', array('label' => __('Bulletin text color', 'moscow'), 'section' => 'colors', 'settings' => 'bulletin_text_color', 'priority' => 13)));
    // Body text color
    $wp_customize->add_setting('body_text_color', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_text_color', array('label' => __('Body text color', 'moscow'), 'section' => 'colors', 'settings' => 'body_text_color', 'priority' => 14)));
    // Footer background color
    $wp_customize->add_setting('footer_bg_color', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_bg_color', array('label' => __('Footer background color', 'moscow'), 'section' => 'colors', 'settings' => 'footer_bg_color', 'priority' => 15)));
    // Footer text color
    $wp_customize->add_setting('footer_text_color', array('default' => '#7C7C7C', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_text_color', array('label' => __('Footer text color', 'moscow'), 'section' => 'colors', 'settings' => 'footer_text_color', 'priority' => 16)));
}
 /**
  * Add postMessage support for site title and description for the Theme Customizer along with several other settings.
  *
  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  * @since  1.0.0
  */
 public function customize_register($wp_customize)
 {
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
     // Move background color setting alongside background image
     $wp_customize->get_control('background_color')->section = 'background_image';
     $wp_customize->get_control('background_color')->priority = 20;
     // Change background image section title & priority
     $wp_customize->get_section('background_image')->title = __('Background', 'storefront');
     $wp_customize->get_section('background_image')->priority = 30;
     // Change header image section title & priority
     $wp_customize->get_section('header_image')->title = __('Header', 'storefront');
     $wp_customize->get_section('header_image')->priority = 25;
     /**
      * Custom controls
      */
     require_once dirname(__FILE__) . '/class-storefront-customizer-control-radio-image.php';
     require_once dirname(__FILE__) . '/class-storefront-customizer-control-arbitrary.php';
     if (apply_filters('storefront_customizer_more', true)) {
         require_once dirname(__FILE__) . '/class-storefront-customizer-control-more.php';
     }
     /**
      * Add the typography section
      */
     $wp_customize->add_section('storefront_typography', array('title' => __('Typography', 'storefront'), 'priority' => 45));
     /**
      * Heading color
      */
     $wp_customize->add_setting('storefront_heading_color', array('default' => apply_filters('storefront_default_heading_color', '#484c51'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_heading_color', array('label' => __('Heading color', 'storefront'), 'section' => 'storefront_typography', 'settings' => 'storefront_heading_color', 'priority' => 20)));
     /**
      * Text Color
      */
     $wp_customize->add_setting('storefront_text_color', array('default' => apply_filters('storefront_default_text_color', '#60646c'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_text_color', array('label' => __('Text color', 'storefront'), 'section' => 'storefront_typography', 'settings' => 'storefront_text_color', 'priority' => 30)));
     /**
      * Accent Color
      */
     $wp_customize->add_setting('storefront_accent_color', array('default' => apply_filters('storefront_default_accent_color', '#2c2d33'), 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_accent_color', array('label' => __('Link / accent color', 'storefront'), 'section' => 'storefront_typography', 'settings' => 'storefront_accent_color', 'priority' => 40)));
     /**
      * Logo
      */
     if (!class_exists('Jetpack')) {
         $wp_customize->add_control(new Arbitrary_Storefront_Control($wp_customize, 'storefront_logo_heading', array('section' => 'header_image', 'type' => 'heading', 'label' => __('Logo', 'storefront'), 'priority' => 2)));
         $wp_customize->add_control(new Arbitrary_Storefront_Control($wp_customize, 'storefront_logo_info', array('section' => 'header_image', 'type' => 'text', 'description' => sprintf(__('Looking to add a logo? Install the %sJetpack%s plugin! %sRead more%s.', 'storefront'), '<a href="https://wordpress.org/plugins/jetpack/">', '</a>', '<a href="http://docs.woothemes.com/document/storefront-faq/#section-1">', '</a>'), 'priority' => 3)));
         $wp_customize->add_control(new Arbitrary_Storefront_Control($wp_customize, 'storefront_logo_divider_after', array('section' => 'header_image', 'type' => 'divider', 'priority' => 4)));
     }
     $wp_customize->add_control(new Arbitrary_Storefront_Control($wp_customize, 'storefront_header_image_heading', array('section' => 'header_image', 'type' => 'heading', 'label' => __('Header background image', 'storefront'), 'priority' => 6)));
     /**
      * Header Background
      */
     $wp_customize->add_setting('storefront_header_background_color', array('default' => apply_filters('storefront_default_header_background_color', '#2c2d33'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_header_background_color', array('label' => __('Background color', 'storefront'), 'section' => 'header_image', 'settings' => 'storefront_header_background_color', 'priority' => 15)));
     /**
      * Header text color
      */
     $wp_customize->add_setting('storefront_header_text_color', array('default' => apply_filters('storefront_default_header_text_color', '#9aa0a7'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_header_text_color', array('label' => __('Text color', 'storefront'), 'section' => 'header_image', 'settings' => 'storefront_header_text_color', 'priority' => 20)));
     /**
      * Header link color
      */
     $wp_customize->add_setting('storefront_header_link_color', array('default' => apply_filters('storefront_default_header_link_color', '#cccccc'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_header_link_color', array('label' => __('Link color', 'storefront'), 'section' => 'header_image', 'settings' => 'storefront_header_link_color', 'priority' => 30)));
     /**
      * Footer section
      */
     $wp_customize->add_section('storefront_footer', array('title' => __('Footer', 'storefront'), 'priority' => 28, 'description' => __('Customise the look & feel of your web site footer.', 'storefront')));
     /**
      * Footer Background
      */
     $wp_customize->add_setting('storefront_footer_background_color', array('default' => apply_filters('storefront_default_footer_background_color', '#f0f0f0'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_footer_background_color', array('label' => __('Background color', 'storefront'), 'section' => 'storefront_footer', 'settings' => 'storefront_footer_background_color', 'priority' => 10)));
     /**
      * Footer heading color
      */
     $wp_customize->add_setting('storefront_footer_heading_color', array('default' => apply_filters('storefront_default_footer_heading_color', '#494c50'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_footer_heading_color', array('label' => __('Heading color', 'storefront'), 'section' => 'storefront_footer', 'settings' => 'storefront_footer_heading_color', 'priority' => 20)));
     /**
      * Footer text color
      */
     $wp_customize->add_setting('storefront_footer_text_color', array('default' => apply_filters('storefront_default_footer_text_color', '#61656b'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_footer_text_color', array('label' => __('Text color', 'storefront'), 'section' => 'storefront_footer', 'settings' => 'storefront_footer_text_color', 'priority' => 30)));
     /**
      * Footer link color
      */
     $wp_customize->add_setting('storefront_footer_link_color', array('default' => apply_filters('storefront_default_footer_link_color', '#2c2d33'), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_footer_link_color', array('label' => __('Link color', 'storefront'), 'section' => 'storefront_footer', 'settings' => 'storefront_footer_link_color', 'priority' => 40)));
     /**
      * Buttons section
      */
     $wp_customize->add_section('storefront_buttons', array('title' => __('Buttons', 'storefront'), 'priority' => 45, 'description' => __('Customise the look & feel of your web site buttons.', 'storefront')));
     /**
      * Button background color
      */
     $wp_customize->add_setting('storefront_button_background_color', array('default' => apply_filters('storefront_default_button_background_color', '#60646c'), 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_button_background_color', array('label' => __('Background color', 'storefront'), 'section' => 'storefront_buttons', 'settings' => 'storefront_button_background_color', 'priority' => 10)));
     /**
      * Button text color
      */
     $wp_customize->add_setting('storefront_button_text_color', array('default' => apply_filters('storefront_default_button_text_color', '#ffffff'), 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_button_text_color', array('label' => __('Text color', 'storefront'), 'section' => 'storefront_buttons', 'settings' => 'storefront_button_text_color', 'priority' => 20)));
     /**
      * Button alt background color
      */
     $wp_customize->add_setting('storefront_button_alt_background_color', array('default' => apply_filters('storefront_default_button_alt_background_color', '#2c2d33'), 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_button_alt_background_color', array('label' => __('Alternate button background color', 'storefront'), 'section' => 'storefront_buttons', 'settings' => 'storefront_button_alt_background_color', 'priority' => 30)));
     /**
      * Button alt text color
      */
     $wp_customize->add_setting('storefront_button_alt_text_color', array('default' => apply_filters('storefront_default_button_alt_text_color', '#ffffff'), 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'storefront_button_alt_text_color', array('label' => __('Alternate button text color', 'storefront'), 'section' => 'storefront_buttons', 'settings' => 'storefront_button_alt_text_color', 'priority' => 40)));
     /**
      * Layout
      */
     $wp_customize->add_section('storefront_layout', array('title' => __('Layout', 'storefront'), 'priority' => 50));
     $wp_customize->add_setting('storefront_layout', array('default' => apply_filters('storefront_default_layout', $layout = is_rtl() ? 'left' : 'right'), 'sanitize_callback' => 'storefront_sanitize_choices'));
     $wp_customize->add_control(new Storefront_Custom_Radio_Image_Control($wp_customize, 'storefront_layout', array('settings' => 'storefront_layout', 'section' => 'storefront_layout', 'label' => __('General Layout', 'storefront'), 'priority' => 1, 'choices' => array('right' => get_template_directory_uri() . '/assets/images/customizer/controls/2cr.png', 'left' => get_template_directory_uri() . '/assets/images/customizer/controls/2cl.png'))));
     /**
      * More
      */
     if (apply_filters('storefront_customizer_more', true)) {
         $wp_customize->add_section('storefront_more', array('title' => __('More', 'storefront'), 'priority' => 999));
         $wp_customize->add_setting('storefront_more', array('default' => null, 'sanitize_callback' => 'sanitize_text_field'));
         $wp_customize->add_control(new More_Storefront_Control($wp_customize, 'storefront_more', array('label' => __('Looking for more options?', 'storefront'), 'section' => 'storefront_more', 'settings' => 'storefront_more', 'priority' => 1)));
     }
 }
Ejemplo n.º 26
-1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function bridger_customize_register($wp_customize)
{
    $wp_customize->get_section('title_tagline')->title = __('Site Title (Logo) & Tagline', 'bridger');
    $wp_customize->get_section('title_tagline')->priority = 10;
    // site title
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_control('blogname')->priority = 10;
    // brand logo
    $wp_customize->add_setting('brand_logo', array('default' => null));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'brand_logo', array('label' => __('Your Brand Logo (replaces title text)', 'bridger'), 'section' => 'title_tagline', 'settings' => 'brand_logo', 'priority' => 20)));
    // site tagline
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_control('blogdescription')->priority = 30;
    // hide tagline
    $wp_customize->add_setting('bridger_hide_tagline', array('default' => 0, 'sanitize_callback' => 'bridger_sanitize_checkbox'));
    $wp_customize->add_control('bridger_hide_tagline', array('label' => __('Hide tagline', 'bridger'), 'section' => 'title_tagline', 'priority' => 40, 'type' => 'checkbox'));
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // $wp_customize->get_setting( 'brand_color_primary' )->transport = 'postMessage';
    // $wp_customize->get_setting( 'brand_color_secondary' )->transport = 'postMessage';
    // $wp_customize->get_setting( 'brand_color_tertiary' )->transport = 'postMessage';
}
Ejemplo n.º 27
-1
 /**
  * Register header settings.
  *
  * @since 1.0.0
  *
  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  */
 function kihon_customize_register_header($wp_customize)
 {
     /**
      * Configure some WP default settings to fit this section.
      */
     $wp_customize->get_section('title_tagline')->title = 'Site Header';
     // $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
     // Move header image control to title_tagline because it belongs together
     $wp_customize->get_control('header_image')->section = 'title_tagline';
     $wp_customize->get_control('header_image')->priority = 11;
     // Header Text Color changed to site title color
     $wp_customize->get_control('header_textcolor')->label = 'Site Title Color';
     // Remove site tagline because this theme doesn't support it front end
     // $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     $wp_customize->remove_control('blogdescription');
     // $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
     // Custom settings and controls
     $wp_customize->add_setting('kihon_site_header_height', array('default' => 80, 'sanitize_callback' => 'kihon_sanitize_integer'));
     $wp_customize->add_control('kihon_site_header_height', array('label' => __('Site Header Height (px)', 'kihon'), 'section' => 'title_tagline', 'type' => 'text'));
     $wp_customize->add_setting('kihon_site_header_fixed', array('default' => 'on', 'sanitize_callback' => 'kihon_sanitize_radio_or_select'));
     $wp_customize->add_control('kihon_site_header_fixed', array('label' => __('Fixed Header?', 'kihon'), 'description' => __('Fix header to top when scrolled down.', 'kihon'), 'section' => 'title_tagline', 'type' => 'select', 'choices' => array('on' => __('On', 'kihon'), 'off' => __('Off', 'kihon'))));
 }
Ejemplo n.º 28
-1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function gently_customize_register($wp_customize)
{
    if (class_exists('Kirki')) {
        $wp_customize->add_section('color', array('title' => __('Color', 'gently'), 'priority' => 81));
        $wp_customize->add_section('typography', array('title' => __('Typography', 'gently'), 'priority' => 82));
        $wp_customize->add_section('header', array('title' => __('Top bar', 'gently'), 'priority' => 91));
        $wp_customize->add_section('sidebar', array('title' => __('Sidebar', 'gently'), 'priority' => 101));
        $wp_customize->add_section('footer', array('title' => __('Footer', 'gently'), 'priority' => 111));
        $wp_customize->add_section('social', array('title' => __('Social Media', 'gently'), 'priority' => 112, 'description' => __('Share buttons will be displayed under each single post.', 'gently')));
        if (function_exists('mc4wp_show_form')) {
            $wp_customize->add_section('newsletter', array('title' => __('Newsletter', 'gently'), 'priority' => 113));
        }
        // Rename default section
        $background_section = $wp_customize->get_section('background_image');
        $background_section->title = __('Background', 'gently');
        // Move background color to custom section
        $background_color_control = $wp_customize->get_control('background_color');
        $background_color_control->section = 'background_image';
        // Change blogname setting transport to post, description and title
        $blogname_setting = $wp_customize->get_setting('blogname');
        $blogname_setting->transport = 'postMessage';
        $blogname_controll = $wp_customize->get_control('blogname');
        $blogname_controll->description = __('If you want to use text version of logo remove images above.', 'gently');
        // Change Header image section order
        $header_image_section = $wp_customize->get_section('header_image');
        $header_image_section->priority = 99;
        // Remove unused header text and text color controls
        $wp_customize->remove_control('display_header_text');
        $wp_customize->remove_control('header_textcolor');
        // Remove tagline field
        $wp_customize->remove_setting('blogdescription');
        $wp_customize->remove_control('blogdescription');
    } else {
        // Convert default section to a notice that inform user about more options in customzier when they install Kirki plugin.
        $wp_customize->add_section('notice', array('title' => __('Install Kirki for more options.', 'gently'), 'priority' => 1, 'description' => __('This theme uses free plugin from wordpress.org - Kirki. Install it to use many customizer options that comes with this theme.', 'gently')));
        $wp_customize->add_setting('install_notice', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
        $wp_customize->add_control('install_notice', array('section' => 'notice', 'label' => '', 'type' => ''));
    }
}
Ejemplo n.º 29
-1
 /**
  * Theme customization.
  *
  * @param   WP_Customize_Manager $wp_customize
  * @return  void
  */
 public function customize_register($wp_customize)
 {
     $wp_customize->get_section('title_tagline')->priority = 0;
     $wp_customize->get_control('blogname')->priority = 2;
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_control('blogdescription')->priority = 3;
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $this->add_section_settings('title_tagline', $this->get_site_identity_settings());
     $this->add_section('layout', $this->get_layout_section(40));
     $this->add_section('colour', $this->get_colour_section(60));
     $this->add_section('footer', $this->get_footer_section(100));
     $this->add_section('campaigns', $this->get_campaign_section(120));
     $this->add_section('social', $this->get_social_profiles_section(140));
     /* Background Images Panel */
     $this->add_panel('background_images', $this->get_background_images_panel());
     /* Abort if selective refresh is not available. */
     if (!isset($wp_customize->selective_refresh)) {
         return;
     }
     $wp_customize->selective_refresh->add_partial('header_site_title', array('selector' => '.site-title a', 'settings' => array('blogname'), 'render_callback' => array($this, 'render_site_title')));
     $wp_customize->selective_refresh->add_partial('document_title', array('selector' => 'head > title', 'settings' => array('blogname'), 'render_callback' => 'wp_get_document_title'));
     $wp_customize->selective_refresh->add_partial('header_site_description', array('selector' => '.site-tagline', 'settings' => array('blogdescription'), 'render_callback' => array($this, 'render_site_description')));
     $wp_customize->selective_refresh->add_partial('footer_text', array('selector' => '.footer-notice', 'settings' => array('footer_tagline'), 'render_callback' => array($this, 'render_footer_text')));
 }
Ejemplo n.º 30
-1
 /**
  * @see WP_Widget_Form_Customize_Control::json()
  */
 function test_wp_widget_form_customize_control_json()
 {
     $this->do_customize_boot_actions();
     $control = $this->manager->get_control('widget_search[2]');
     $params = $control->json();
     $this->assertEquals('widget_form', $params['type']);
     $this->assertRegExp('#^<li[^>]+>\\s+</li>$#', $params['content']);
     $this->assertRegExp('#^<div[^>]*class=\'widget\'[^>]*#s', $params['widget_control']);
     $this->assertContains('<div class="widget-content"></div>', $params['widget_control']);
     $this->assertNotContains('<input class="widefat"', $params['widget_control']);
     $this->assertContains('<input class="widefat"', $params['widget_content']);
     $this->assertEquals('search-2', $params['widget_id']);
     $this->assertEquals('search', $params['widget_id_base']);
     $this->assertArrayHasKey('sidebar_id', $params);
     $this->assertArrayHasKey('width', $params);
     $this->assertArrayHasKey('height', $params);
     $this->assertInternalType('bool', $params['is_wide']);
 }