Retrieve a customize section.
public get_section ( string $id ) : WP_Customize_Section | void | ||
$id | string | Section ID. |
return | WP_Customize_Section | void | The section, if set. |
/** * 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')))); }
/** * 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')))); }
/** * Implement Theme Customizer additions and adjustments. * * @since Longform 1.0 * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function longform_customize_register($wp_customize) { // Add custom description to Colors and Background sections. $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'longform'); $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'longform'); // Add postMessage support for site title and description. $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'longform'); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'longform'); // Add the featured content section in case it's not already there. $wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'longform'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'longform'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130)); // Add the featured content layout setting and control. $wp_customize->add_setting('featured_content_layout', array('default' => 'slider', 'sanitize_callback' => 'longform_sanitize_layout')); $wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'longform'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('slider' => __('Slider', 'longform')))); // Add General setting panel and configure settings inside it $wp_customize->add_panel('longform_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'longform'), 'description' => __('You can configure your general theme settings here', 'longform'))); // Website logo $wp_customize->add_section('longform_general_logo', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Website logo', 'longform'), 'description' => __('Please upload your logo, recommended logo size should be between 262x80', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_logo', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_logo', array('label' => __('Website logo', 'longform'), 'section' => 'longform_general_logo', 'settings' => 'longform_logo'))); // Copyright $wp_customize->add_section('longform_general_copyright', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Copyright', 'longform'), 'description' => __('Please provide short copyright text which will be shown in footer.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_copyright', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_copyright', array('label' => 'Copyright', 'section' => 'longform_general_copyright', 'type' => 'text')); // Scroll to top $wp_customize->add_section('longform_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'longform'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_scrolltotop', array('sanitize_callback' => 'longform_sanitize_checkbox')); $wp_customize->add_control('longform_scrolltotop', array('label' => 'Scroll to top', 'section' => 'longform_general_scrolltotop', 'type' => 'checkbox')); // Favicon $wp_customize->add_section('longform_general_favicon', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Favicon', 'longform'), 'description' => __('Do you have favicon? You can upload it here.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_favicon', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_favicon', array('label' => __('Favicon', 'longform'), 'section' => 'longform_general_favicon', 'settings' => 'longform_favicon'))); // Page layout $wp_customize->add_section('longform_general_layout', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Layout', 'longform'), 'description' => __('Choose a layout for your theme pages. Note that a widget has to be inside widget are, or the layout won\'t change.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_layout', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_layout', array('type' => 'radio', 'label' => 'Layout', 'section' => 'longform_general_layout', 'choices' => array('full' => 'Full', 'right' => 'Right'))); // Add Stories grid setting panel and configure settings inside it $wp_customize->add_panel('longform_stories_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => __('Stories grid', 'longform'), 'description' => __('You can configure your themes stories grid here.', 'longform'))); // Grid tag $wp_customize->add_section('longform_stories_tag', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Grid tag', 'longform'), 'description' => __('Please provide tag name of the posts which you want to show in "Stories grid" page.', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_tag', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_tag', array('label' => 'Grid tag', 'section' => 'longform_stories_tag', 'type' => 'text')); // Stories per page $wp_customize->add_section('longform_stories_perpage', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories per page', 'longform'), 'description' => __('How much stories should be showed per page?', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_per_page', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_per_page', array('label' => 'Stories per page', 'section' => 'longform_stories_perpage', 'type' => 'text')); // Stories order $wp_customize->add_section('longform_stories_order', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories order', 'longform'), 'description' => __('The order for stories page', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_main_order', array('default' => 'ASC', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_main_order', array('label' => 'Stories order', 'section' => 'longform_stories_order', 'type' => 'select', 'choices' => array('ASC' => __('Ascending', 'longform'), 'DESC' => __('Descending', 'longform')))); // Social links $wp_customize->add_section(new longform_Customized_Section($wp_customize, 'longform_social_links', array('priority' => 300, 'capability' => 'edit_theme_options'))); $wp_customize->add_setting('longform_fake_field', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_fake_field', array('label' => '', 'section' => 'longform_social_links', 'type' => 'text')); }
/** * Register postMessage support for site title and description for the Customizer. * * @param WP_Customize_Manager $wp_customize Customizer object. * @since SG Window 1.0.0 */ function sgwindow_customize_register($wp_customize) { $wp_customize->add_panel('background', array('priority' => 105, 'title' => __('Customize Background', 'sg-window'), 'description' => __('Background.', 'sg-window'))); $wp_customize->add_panel('navigation', array('priority' => 106, 'title' => __('Customize Menu', 'sg-window'), 'description' => __('Navigation settings.', 'sg-window'))); //Sets postMessage support $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; $wp_customize->get_section('colors')->panel = 'custom_colors'; $wp_customize->get_section('colors')->priority = '1'; $wp_customize->get_section('background_image')->panel = 'background'; $wp_customize->get_section('background_image')->priority = '10'; $wp_customize->get_section('background_image')->priority = '10'; }
/** * Implement Theme Customizer additions and adjustments. * * @since Boron 1.0 * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function boron_customize_register($wp_customize) { // Add custom description to Colors and Background sections. $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'boron'); $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'boron'); // Add postMessage support for site title and description. $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'boron'); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'boron'); // Add General setting panel and configure settings inside it $wp_customize->add_panel('boron_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'boron'), 'description' => __('You can configure your general theme settings here', 'boron'))); // Add navigation setting panel and configure settings inside it $wp_customize->add_panel('boron_navigation_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('Side navigation settings', 'boron'), 'description' => __('You can configure your theme side navigation settings here.', 'boron'))); // Scroll to top $wp_customize->add_section('boron_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'boron'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'boron'), 'panel' => 'boron_general_panel')); $wp_customize->add_setting('boron_scrolltotop', array('sanitize_callback' => 'boron_sanitize_checkbox')); $wp_customize->add_control('boron_scrolltotop', array('label' => __('Scroll to top', 'boron'), 'section' => 'boron_general_scrolltotop', 'type' => 'checkbox')); // Post background $wp_customize->add_section('boron_post_bg', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Post background', 'boron'), 'description' => __('Do you want your own post background? You can change it here.', 'boron'), 'panel' => 'boron_general_panel')); $wp_customize->add_setting('boron_post_background', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_post_background', array('label' => __('Post background', 'boron'), 'section' => 'boron_post_bg', 'settings' => 'boron_post_background'))); // Comment position $wp_customize->add_section('boron_post_comments', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post comments', 'boron'), 'description' => __('Choose where to show post comments.', 'boron'), 'panel' => 'boron_general_panel')); $wp_customize->add_setting('boron_comment_location', array('default' => 'side', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('boron_comment_location', array('label' => __('Post comments position', 'boron'), 'section' => 'boron_post_comments', 'type' => 'select', 'choices' => array('side' => 'Right side', 'bottom' => 'After post content'))); // Grid size $wp_customize->add_section('boron_grid_size', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post grid size', 'boron'), 'description' => __('Choose how many columns will there be at the post grid.', 'boron'), 'panel' => 'boron_general_panel')); $wp_customize->add_setting('boron_grid_columns', array('default' => '4', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('boron_grid_columns', array('label' => __('Post grid size', 'boron'), 'section' => 'boron_grid_size', 'type' => 'select', 'choices' => array('2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6'))); // Background $wp_customize->add_section('boron_navigation_bg', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Navigation background', 'boron'), 'description' => __('Do you want your own navigation background? You can change it here.', 'boron'), 'panel' => 'boron_navigation_panel')); $wp_customize->add_setting('boron_navigation_background', array('sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() . '/images/navigation-bg.png')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_navigation_background', array('label' => __('Navigation background', 'boron'), 'section' => 'boron_navigation_bg', 'settings' => 'boron_navigation_background'))); // Navigation title $wp_customize->add_section('boron_navigation_title', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Navigation title', 'boron'), 'description' => __('Title for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel')); $wp_customize->add_setting('boron_nav_title', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('boron_nav_title', array('label' => __('Navigation title', 'boron'), 'section' => 'boron_navigation_title', 'type' => 'text')); // Navigation description $wp_customize->add_section('boron_navigation_description', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Navigation description', 'boron'), 'description' => __('Description for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel')); $wp_customize->add_setting('boron_nav_description', array('sanitize_callback' => 'boron_sanitize_textarea')); $wp_customize->add_control('boron_nav_description', array('label' => __('Navigation description', 'boron'), 'section' => 'boron_navigation_description', 'type' => 'textarea')); // Social links $wp_customize->add_section(new boron_Customized_Section($wp_customize, 'boron_social_links', array('priority' => 300, 'capability' => 'edit_theme_options'))); $wp_customize->add_setting('boron_fake_field', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('boron_fake_field', array('label' => '', 'section' => 'boron_social_links', 'type' => 'text')); }
/** * Add postMessage support for site title and description for the Customizer. * * @since Kute Theme 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function kt_customize_register($wp_customize) { $color_scheme = kt_get_color_scheme(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; // Add color scheme setting and control. $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'kt_sanitize_color_scheme', 'transport' => 'postMessage')); $wp_customize->add_control('color_scheme', array('label' => esc_attr__('Base Color Scheme', 'kutetheme'), 'section' => 'colors', 'type' => 'select', 'choices' => kt_get_color_scheme_choices(), 'priority' => 1)); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting('main_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_color', array('label' => esc_attr__('Theme Color', 'kutetheme'), 'description' => esc_attr__('Applied to the theme color.', 'kutetheme'), 'section' => 'colors'))); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control('header_textcolor'); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('box_background_color', array('default' => $color_scheme[2], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'box_background_color', array('label' => esc_attr__('Box and Sidebar Background Color', 'kutetheme'), 'description' => esc_attr__('Applied to the box and sidebar color.', 'kutetheme'), 'section' => 'colors'))); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('textcolor', array('default' => $color_scheme[3], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'textcolor', array('label' => esc_attr__('Text Color', 'kutetheme'), 'description' => esc_attr__('Applied to the text color', 'kutetheme'), 'section' => 'colors'))); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('price_color', array('default' => $color_scheme[8], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'price_color', array('label' => esc_attr__('Price Color', 'kutetheme'), 'description' => esc_attr__('Applied to the price on wide screens.', 'kutetheme'), 'section' => 'colors'))); // Add an additional description to the header image section. $wp_customize->get_section('header_image')->description = esc_attr__('Applied to the header on small screens and the sidebar on wide screens.', 'kutetheme'); }
/** * Handle a section entry * * @param $id * @param array $data * @param array|null $settings * @param $panel_id */ public function setSection($id, array $data, array $settings = null, $panel_id = null) { $section_data = $this->getSectionData($data, $panel_id); if (is_null($panel_id) && isset($data['panel'])) { $panel_id = $data['panel']; } if (is_null($settings) && isset($data['settings'])) { $settings = $data['settings']; } $item = $this->customizer->get_section($id); if ($item) { foreach ($data as $var => $val) { if (array_key_exists($var, $section_data)) { $item->{$var} = $val; } if (!empty($panel_id)) { $item->panel = $panel_id; } } if (isset($data['delete']) && $data['delete'] === true) { $this->customizer->remove_section($id); } } else { $this->customizer->add_section(new WP_Customize_Section($this->customizer, $id, $section_data)); } if (!is_null($settings)) { $settings['object'] = 'settings'; $settings['section'] = $id; $this->processData($settings); } }
/** * 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')); }
/** * Add new controls and postMessage support for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function padhang_customize_register($wp_customize) { // require cusom customizer controls require_once get_template_directory() . '/inc/customizer-controls.php'; // Rename Background Image section to Background $wp_customize->get_section('background_image')->title = __('Background', 'padhang'); // Move Background Color to Background section $wp_customize->get_control('background_color')->section = 'background_image'; /** * General section */ $wp_customize->add_section('padhang_general_section', array('title' => __('General', 'padhang'), 'priority' => 10)); $wp_customize->add_setting('fonts_kit', array('default' => 'roboto', 'sanitize_callback' => 'padhang_sanitize_fontskit')); $wp_customize->add_control('fonts_kit', array('label' => __('Fonts Kit', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'fonts_kit', 'type' => 'select', 'choices' => array('roboto' => 'Roboto + Roboto Slab', 'opensans' => 'Open Sans + Bitter'))); $wp_customize->add_setting('wrapper_width', array('default' => '96', 'sanitize_callback' => 'padhang_wrapper_width_sanitize')); $wp_customize->add_control('wrapper_width', array('label' => __('Wrapper width (%)', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'wrapper_width', 'type' => 'text')); $wp_customize->add_setting('footer_text', array('default' => '© 2014 <a href="' . esc_url(home_url('/')) . '">' . bloginfo('name') . '</a>', 'sanitize_callback' => 'wp_kses_data')); $wp_customize->add_control(new Padhang_Customize_Textarea_Control($wp_customize, 'footer_text', array('label' => __('Footer text', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'footer_text'))); /** * Title and Tagline section */ $wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'options_heading', array('section' => 'title_tagline', 'type' => 'heading', 'label' => __('Title and Tagline Options', 'padhang')))); $wp_customize->add_setting('show_hide_title', array('default' => 1, 'sanitize_callback' => 'absint')); $wp_customize->add_control('show_hide_title', array('label' => __('Show site title', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_title', 'type' => 'checkbox')); $wp_customize->add_setting('show_hide_tagline', array('default' => 1, 'sanitize_callback' => 'absint')); $wp_customize->add_control('show_hide_tagline', array('label' => __('Show site tagline', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_tagline', 'type' => 'checkbox')); /** * Logo section */ $wp_customize->add_section('padhang_logo_section', array('title' => __('Logo', 'padhang'), 'priority' => 30)); $wp_customize->add_setting('logo_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'logo_image', array('label' => __('Logo', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'logo_image', 'context' => 'padhang-logo-image'))); $wp_customize->add_setting('favicon_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'favicon_image', array('label' => __('Favicon', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'favicon_image', 'context' => 'padhang-favicon-image'))); /** * Colors section */ $wp_customize->add_setting('site_title_color', array('default' => '#ffffff')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_title_color', array('label' => __('Title Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_title_color'))); $wp_customize->add_setting('site_tagline_color', array('default' => '#ffffff')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_tagline_color', array('label' => __('Tagline Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_tagline_color'))); $wp_customize->add_setting('accent_color', array('default' => '#65b045')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => __('Accent Color', 'padhang'), 'section' => 'colors', 'settings' => 'accent_color'))); $wp_customize->add_setting('overlay_color', array('default' => '#222222')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'overlay_color', array('label' => __('Overlay Color (%)', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_color'))); $wp_customize->add_setting('overlay_transparency', array('default' => '70', 'sanitize_callback' => 'padhang_transparency_sanitize')); $wp_customize->add_control('overlay_transparency', array('label' => __('Overlay Transparency', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_transparency', 'type' => 'text')); $wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'overlay_transparency_description', array('section' => 'colors', 'type' => 'text', 'description' => __('Set 0 to disable overlay.', 'padhang')))); /** * Background section */ $wp_customize->add_setting('background_cover', array('default' => 0, 'sanitize_callback' => 'absint')); $wp_customize->add_control('background_cover', array('label' => __('Make background image covering the page', 'padhang'), 'section' => 'background_image', 'settings' => 'background_cover', 'type' => 'checkbox')); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; }
/** * Implement Theme Customizer additions and adjustments. * * @since Beryl 1.0 * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function beryl_customize_register($wp_customize) { // Add custom description to Colors and Background sections. $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'beryl'); $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'beryl'); // Add postMessage support for site title and description. $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'beryl'); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'beryl'); $wp_customize->get_section('header_image')->title = __('Logo', 'beryl'); // Social links $wp_customize->add_section(new beryl_Customized_Section($wp_customize, 'beryl_social_links', array('priority' => 300, 'capability' => 'edit_theme_options'))); $wp_customize->add_setting('beryl_fake_field', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('beryl_fake_field', array('label' => '', 'section' => 'beryl_social_links', 'type' => 'text')); }
/** * Implement Theme Customizer additions and adjustments. * * @since Twenty Fourteen 1.0 * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function twentyfourteen_customize_register($wp_customize) { // Add custom description to Colors and Background sections. $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'twentyfourteen'); $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'twentyfourteen'); // Add postMessage support for site title and description. $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'twentyfourteen'); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'twentyfourteen'); // Add the featured content section in case it's not already there. $wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'twentyfourteen'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130)); // Add the featured content layout setting and control. $wp_customize->add_setting('featured_content_layout', array('default' => 'grid', 'sanitize_callback' => 'twentyfourteen_sanitize_layout')); $wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'twentyfourteen'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('grid' => __('Grid', 'twentyfourteen'), 'slider' => __('Slider', 'twentyfourteen')))); }
/** * Add postMessage support for site title and description for the Customizer. * * @since Twenty Fifteen 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function HuI_customize_register($wp_customize) { $color_scheme = HuI_get_color_scheme(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('blog_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_background_color', array('label' => __('blog Background Color', 'HuI'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'HuI'), 'section' => 'colors'))); // Add an additional description to the header image section. $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'HuI'); }
/** * 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); }
/** * Check if the theme supports the control and check user capabilities. * * @since 3.4.0 * * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true. */ public final function check_capabilities() { foreach ($this->settings as $setting) { //if ( ! $setting->check_capabilities() ) // return false; } $section = $this->manager->get_section($this->section); if (isset($section) && !$section->check_capabilities()) { return false; } return true; }
/** * 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); } }
/** * 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); }
/** * Checks if the user can use this control. * * Returns false if the user cannot manipulate one of the associated settings, * or if one of the associated settings does not exist. Also returns false if * the associated section does not exist or if its capability check returns * false. * * @since 3.4.0 * * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true. */ public final function check_capabilities() { if (!empty($this->capability) && !current_user_can($this->capability)) { return false; } foreach ($this->settings as $setting) { if (!$setting || !$setting->check_capabilities()) { return false; } } $section = $this->manager->get_section($this->section); if (isset($section) && !$section->check_capabilities()) { return false; } return true; }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function meg_n_boots_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'; /** * Additional Customizer Options and changes */ //Customize Title Section $wp_customize->get_section('title_tagline')->title = __('Site Title, Tagline, & Icon', 'meg_n_boots'); //Hero Image and Title Section $wp_customize->add_section('meg_n_boots_hero_title', array('title' => __('Hero Image and Title', 'meg-n-boots'), 'priority' => 61)); $wp_customize->add_setting('meg_n_boots_hero_title', array('default' => 'A nice, bold title!', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('meg_n_boots_hero_title', array('label' => __('Hero Title', 'meg-n-boots'), 'description' => __('This is the text you want overlayed on your front page Hero Image.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'type' => 'text', 'priority' => 1)); $wp_customize->add_setting('meg_n_boots_hero_subtitle', array('default' => 'And a smalled, supporting subtitle to go with it.', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('meg_n_boots_hero_subtitle', array('label' => __('Hero Subtitle', 'meg-n-boots'), 'description' => __('This is the subtitle text you want overlayed on your front page Hero Image.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'type' => 'text', 'priority' => 2)); $wp_customize->add_setting('meg_n_boots_hero_image', array('default' => '../img/boots-mtn.jpg', 'sanitize_callback' => 'esc_url')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'meg_n_boots_hero_image', array('label' => __('Hero Image', 'meg-n-boots'), 'description' => __('This is the hero image you want displayed, should be at the dimensions 2000 x 745 pixels, or proportionally larger. best results are with images 2000px or wider.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'settings' => 'meg_n_boots_hero_image', 'priority' => 20))); //End Hero Image and Title Section // Add Color Options for Theme // remove default color areas $wp_customize->remove_control('header_textcolor'); $wp_customize->remove_control('background_color'); $wp_customize->add_setting('site_primary_color', array('default' => '#d43f3a', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_primary_color', array('label' => 'Site Primary Color', 'section' => 'colors', 'settings' => 'site_primary_color', 'priority' => 1))); $wp_customize->add_setting('title_text_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'title_text_color', array('label' => 'Title Text Color', 'section' => 'colors', 'settings' => 'title_text_color', 'priority' => 2))); $wp_customize->add_setting('body_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_color', array('label' => 'Body Color', 'section' => 'colors', 'settings' => 'body_color', 'priority' => 11))); $wp_customize->add_setting('text_color', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'text_color', array('label' => 'Text Color', 'section' => 'colors', 'settings' => 'text_color', 'priority' => 12))); $wp_customize->add_setting('link_color', array('default' => '#337ab7', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => 'Link Color', 'section' => 'colors', 'settings' => 'link_color', 'priority' => 15))); $wp_customize->add_setting('background_theme_color', array('default' => '#e9e9e9', 'sanitize_callback' => 'sanitize_hex_color')); // add color picker control $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'background_theme_color', array('label' => 'Background Theme Color', 'section' => 'colors', 'settings' => 'background_theme_color', 'priority' => 20))); // Add Color Options for Theme }
/** * Add postMessage support for site title and description for the Customizer. * * @since Twenty Fifteen 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function broadwaydental_customize_register($wp_customize) { $color_scheme = broadwaydental_get_color_scheme(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; // Add color scheme setting and control. $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'broadwaydental_sanitize_color_scheme', 'transport' => 'postMessage')); $wp_customize->add_control('color_scheme', array('label' => __('Base Color Scheme', 'broadwaydental'), 'section' => 'colors', 'type' => 'select', 'choices' => broadwaydental_get_color_scheme_choices(), 'priority' => 1)); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting('sidebar_textcolor', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array('label' => __('Header and Sidebar Text Color', 'broadwaydental'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental'), 'section' => 'colors'))); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control('header_textcolor'); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('header_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array('label' => __('Header and Sidebar Background Color', 'broadwaydental'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental'), 'section' => 'colors'))); // Add an additional description to the header image section. $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental'); }
/** * Use a "alias" method to register sections to allow users to filter args and the ID * * @since 4.0 * * @param string $id The Unique section ID * @param array $args Arguments to register the section * * @link https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_section * * @return WP_Customize_Section */ public function register_section($id, $args) { $section_id = apply_filters('tribe_events_pro_customizer_section_id', $id, $this); $section = $this->manager->get_section($section_id); // If the Panel already exists we leave returning it's instance if (!empty($section)) { return $section; } /** * Filter the Section arguments, so that developers can filter arguments based on $section_id * @var array */ $section_args = apply_filters('tribe_events_pro_customizer_section_args', $args, $section_id, $this); // Don't allow sections outside of our panel $section_args['panel'] = $this->panel->id; // Actually Register the Section $this->manager->add_section($section_id, $section_args); // Return the Section instance return $this->manager->get_section($section_id); }
/** * Add postMessage support for site title and description for the Customizer. * * @since Twenty Fifteen 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function twentyfifteen_customize_register($wp_customize) { $color_scheme = twentyfifteen_get_color_scheme(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->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' => 'twentyfifteen_customize_partial_blogname')); $wp_customize->selective_refresh->add_partial('blogdescription', array('selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'twentyfifteen_customize_partial_blogdescription')); } // Add color scheme setting and control. $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', 'transport' => 'postMessage')); $wp_customize->add_control('color_scheme', array('label' => __('Base Color Scheme', 'diductio'), 'section' => 'colors', 'type' => 'select', 'choices' => twentyfifteen_get_color_scheme_choices(), 'priority' => 1)); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting('sidebar_textcolor', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array('label' => __('Header and Sidebar Text Color', 'diductio'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio'), 'section' => 'colors'))); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control('header_textcolor'); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('header_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array('label' => __('Header and Sidebar Background Color', 'diductio'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio'), 'section' => 'colors'))); // Add an additional description to the header image section. $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio'); }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function keratin_customize_register($wp_customize) { $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('background_color')->transport = 'postMessage'; // Getting Started Section $wp_customize->add_section('keratin_getting_started', array('title' => __('Getting Started', 'keratin'), 'description' => __('Thanks for your interest in Keratin! If you have any questions or run into any trouble, please visit us the following links. We will get you fixed up!', 'keratin'), 'priority' => 1)); // Documentation $wp_customize->add_setting('keratin_documentation', array('default' => '')); $wp_customize->add_control(new WP_Keratin_Button_Control($wp_customize, 'keratin_documentation', array('label' => __('Documentation', 'keratin'), 'section' => 'keratin_getting_started', 'type' => 'button', 'button_tag' => 'a', 'button_class' => 'button button-primary', 'button_href' => 'http://themecot.com/keratin-theme-documentation/', 'button_target' => '_blank'))); // Contact $wp_customize->add_setting('keratin_contact', array('default' => '')); $wp_customize->add_control(new WP_Keratin_Button_Control($wp_customize, 'keratin_contact', array('label' => __('Contact Us', 'keratin'), 'section' => 'keratin_getting_started', 'type' => 'button', 'button_tag' => 'a', 'button_class' => 'button button-primary', 'button_href' => 'http://themecot.com/contact/', 'button_target' => '_blank'))); // Theme Options Section $wp_customize->add_section('keratin_theme_options', array('title' => __('Theme Options', 'keratin'), 'priority' => 2)); // Theme Layout $wp_customize->add_setting('keratin_theme_layout', array('default' => 'box', 'sanitize_callback' => 'keratin_sanitize_theme_layout')); $wp_customize->add_control('keratin_theme_layout', array('label' => __('Theme Layout', 'keratin'), 'section' => 'keratin_theme_options', 'priority' => 2, 'type' => 'select', 'choices' => array('wide' => __('Wide', 'keratin'), 'box' => __('Box', 'keratin')))); // Update the Customizer section title for discoverability. $wp_customize->get_section('title_tagline')->title = __('Site Title, Tagline, and Logo', 'keratin'); // Logo $wp_customize->add_setting('keratin_logo', array('default' => '', 'sanitize_callback' => 'keratin_sanitize_url')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'keratin_logo', array('label' => __('Logo', 'keratin'), 'section' => 'title_tagline'))); }
/** * 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. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function awaken_customize_register($wp_customize) { require get_template_directory() . '/inc/customizer/custom-controls/control-category-dropdown.php'; require get_template_directory() . '/inc/customizer/custom-controls/control-custom-content.php'; $wp_customize->remove_section('themes'); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; $wp_customize->get_section('static_front_page')->panel = 'awaken_home_settings'; $wp_customize->get_section('background_image')->panel = 'awaken_styling'; $wp_customize->get_section('colors')->panel = 'awaken_styling'; /** * Header Settings Panel */ $wp_customize->add_panel('awaken_header_settings', array('title' => __('Header Settings', 'awaken'), 'description' => __('Use this panel to set your header settings', 'awaken'), 'priority' => 25)); // Logo image $wp_customize->add_setting('site_logo', array('sanitize_callback' => 'awaken_sanitize_image')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'site_logo', array('label' => __('Site Logo', 'awaken'), 'section' => 'title_tagline', 'settings' => 'site_logo', 'description' => __('Upload a logo for your website. Recommended height for your logo is 135px.', 'awaken')))); // Logo, title and description chooser $wp_customize->add_setting('site_title_option', array('default' => 'text-only', 'sanitize_callback' => 'awaken_sanitize_logo_title_select', 'transport' => 'refresh')); $wp_customize->add_control('site_title_option', array('label' => __('Display site title / logo.', 'awaken'), 'section' => 'title_tagline', 'type' => 'radio', 'description' => __('Choose your preferred option.', 'awaken'), 'choices' => array('text-only' => __('Display site title and description only.', 'awaken'), 'logo-only' => __('Display site logo image only.', 'awaken'), 'text-logo' => __('Display both site title and logo image.', 'awaken'), 'display-none' => __('Display none', 'awaken')))); // Site favicon $wp_customize->add_setting('site_favicon', array('sanitize_callback' => 'awaken_sanitize_image')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'site_favicon', array('label' => __('Upload a favicon', 'awaken'), 'section' => 'title_tagline', 'settings' => 'site_favicon', 'description' => __('Upload a favicon for your website.', 'awaken')))); // Display site favicon? $wp_customize->add_setting('display_site_favicon', array('default' => false, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('display_site_favicon', array('settings' => 'display_site_favicon', 'section' => 'title_tagline', 'type' => 'checkbox', 'label' => __('Display site favicon?', 'awaken'))); /** * General settings section. */ $wp_customize->add_section('awaken_general_settings', array('title' => __('General Settings', 'awaken'), 'description' => __('Use this section to set general settings of the site.', 'awaken'), 'priority' => 30)); // Read more text. $wp_customize->add_setting('read_more_text', array('default' => '[...]', 'sanitize_callback' => 'awaken_sanitize_html')); $wp_customize->add_control('read_more_text', array('settings' => 'read_more_text', 'section' => 'awaken_general_settings', 'type' => 'textarea', 'label' => __('Read more text', 'awaken'), 'description' => __('Give a read more text for posts. HTML allowed.', 'awaken'))); // Footer copyright text. $wp_customize->add_setting('footer_copyright_text', array('default' => sprintf(__('Copyright %s. All rights reserved.', 'awaken'), esc_html(get_bloginfo('name'))), 'sanitize_callback' => 'awaken_sanitize_html')); $wp_customize->add_control('footer_copyright_text', array('settings' => 'footer_copyright_text', 'section' => 'awaken_general_settings', 'type' => 'textarea', 'label' => __('Footer copyright text', 'awaken'), 'description' => __('Copyright or other text to be displayed in the site footer. HTML allowed.', 'awaken'))); /** * Home Settings section. */ $wp_customize->add_panel('awaken_home_settings', array('title' => __('Homepage Settings', 'awaken'), 'description' => __('Use this panel to set your home page settings', 'awaken'), 'priority' => 31)); /** * Slider Section. */ $wp_customize->add_section('awaken_slider', array('title' => __('Feartured Slider', 'awaken'), 'description' => __('Use this section to setup the homepage slider and featured posts.', 'awaken'), 'panel' => 'awaken_home_settings')); // Display slider? $wp_customize->add_setting('display_slider', array('default' => true, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('display_slider', array('settings' => 'display_slider', 'section' => 'awaken_slider', 'type' => 'checkbox', 'label' => __('Display slider on homepage ?', 'awaken'))); $wp_customize->add_setting('slider_category', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_category_dropdown')); $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'slider_category', array('label' => __('Select the category for slider.', 'awaken'), 'description' => __('Featured images of the posts from selected category will be displayed in the slider', 'awaken'), 'section' => 'awaken_slider', 'settings' => 'slider_category'))); $wp_customize->add_setting('featured_posts_category', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_category_dropdown')); $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'featured_posts_category', array('label' => __('Select the category for featured posts.', 'awaken'), 'description' => __('Featured images of the posts from selected category will be displayed in the slider', 'awaken'), 'section' => 'awaken_slider', 'settings' => 'featured_posts_category'))); /** * Post / Page settings */ $wp_customize->add_section('awaken_post_page_settings', array('title' => __('Post / Page Settings', 'awaken'), 'priority' => 32)); // Show comments on posts. $wp_customize->add_setting('display_post_comments', array('default' => true, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('display_post_comments', array('settings' => 'display_post_comments', 'section' => 'awaken_post_page_settings', 'type' => 'checkbox', 'label' => __('Display post comments.', 'awaken'), 'description' => __('Mark the checkbox if you want to display comments on post articles.', 'awaken'))); // Show comments on pages. $wp_customize->add_setting('display_page_comments', array('default' => true, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('display_page_comments', array('settings' => 'display_page_comments', 'section' => 'awaken_post_page_settings', 'type' => 'checkbox', 'label' => __('Display page comments.', 'awaken'), 'description' => __('Mark the checkbox if you want to display comments on pages.', 'awaken'))); // Show featured image in single posts. $wp_customize->add_setting('show_article_featured_image', array('default' => true, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('show_article_featured_image', array('settings' => 'show_article_featured_image', 'section' => 'awaken_post_page_settings', 'type' => 'checkbox', 'label' => __('Display featured image inside the single post article.', 'awaken'), 'description' => __('Mark the checkbox if you want to show featured image on single post article.', 'awaken'))); /** * Styling Options. */ $wp_customize->add_panel('awaken_styling', array('title' => __('Site Styling', 'awaken'), 'description' => __('Use this section to setup the homepage slider and featured posts.', 'awaken'), 'priority' => 33)); /** * Custom CSS section */ $wp_customize->add_section('awaken_custom_css', array('title' => __('Custom CSS', 'awaken'), 'panel' => 'awaken_styling', 'priority' => 50)); $wp_customize->add_setting('custom_css', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'awaken_sanitize_css')); $wp_customize->add_control('custom_css', array('settings' => 'custom_css', 'section' => 'awaken_custom_css', 'type' => 'textarea', 'label' => __('Custom CSS', 'awaken'), 'description' => __('Define custom CSS be used for your site. Do not enclose in script tags.', 'awaken'))); /** * Social Media */ $wp_customize->add_section('awaken_social_media', array('title' => __('Social Media', 'awaken'), 'priority' => 34)); $wp_customize->add_setting('display_social_icons', array('default' => false, 'sanitize_callback' => 'awaken_sanitize_checkbox')); $wp_customize->add_control('display_social_icons', array('settings' => 'display_social_icons', 'section' => 'awaken_social_media', 'type' => 'checkbox', 'label' => __('Display social icons?', 'awaken'))); $wp_customize->add_setting('facebook_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('facebook_url', array('settings' => 'facebook_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Facebook URL', 'awaken'))); $wp_customize->add_setting('twitter_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('twitter_url', array('settings' => 'twitter_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Twitter URL', 'awaken'))); $wp_customize->add_setting('google_plus_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('google_plus_url', array('settings' => 'google_plus_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Google Plus URL', 'awaken'))); $wp_customize->add_setting('linkedin_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('linkedin_url', array('settings' => 'linkedin_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Linkedin URL', 'awaken'))); $wp_customize->add_setting('rss_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('rss_url', array('settings' => 'rss_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('RSS URL', 'awaken'))); $wp_customize->add_setting('instagram_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('instagram_url', array('settings' => 'instagram_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Instagram URL', 'awaken'))); $wp_customize->add_setting('flickr_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('flickr_url', array('settings' => 'flickr_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Flickr URL', 'awaken'))); $wp_customize->add_setting('youtube_url', array('default' => '', 'sanitize_callback' => 'awaken_sanitize_url')); $wp_customize->add_control('youtube_url', array('settings' => 'youtube_url', 'section' => 'awaken_social_media', 'type' => 'url', 'label' => __('Youtube URL', 'awaken'))); $wp_customize->add_section('awaken_pro_details', array('title' => __('Awaken Pro', 'awaken'), 'priority' => 120)); $wp_customize->add_setting('awaken_pro_desc', array('sanitize_callback' => 'awaken_sanitize_html')); $wp_customize->add_control(new Awaken_Pro_Custom_Content($wp_customize, 'awaken_pro_desc', array('section' => 'awaken_pro_details', 'priority' => 20, 'label' => __('Do you want more features?', 'awaken'), 'content' => __('Then consider buying <a href="http://themezhut.com/themes/awaken-pro/" target="_blank">Awaken Pro.</a><h4>Awaken Pro Features.</h4><ol><li>Ajaxified Post Widgets.</li><li>Google Fonts.</li><li>Unlimited Colors.</li><li>Boxed and Wide Layouts.</li><li>More Customizer Options.</li><li>Custom slider.</li><li>Different sidebars for articles and pages.</li><li>Released under GPL.</li></ol>And more..<p><a class="button" href="http://themezhut.com/demo/awaken-pro/" target="_blank">Awaken Pro Demo</a><a class="button button-primary" href="http://themezhut.com/themes/awaken-pro/" target="_blank">Awaken Pro Details</a></p>', 'awaken') . '</p>'))); }
/** * 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))); } }
/** * 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'; }
/** * 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' => '')); } }
/** * 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')))); }
/** * 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'))); }