add_panel() публичный Метод

Add a customize panel.
С версии: 4.0.0
С версии: 4.5.0 Return added WP_Customize_Panel instance.
public add_panel ( WP_Customize_Panel | string $id, array $args = [] ) : WP_Customize_Panel
$id WP_Customize_Panel | string Customize Panel object, or Panel ID.
$args array Optional. Panel arguments. Default empty array.
Результат WP_Customize_Panel The instance of the panel that was added.
Пример #1
1
/**
 * Theme Options Customizer Implementation.
 *
 * Implement the Theme Customizer for Theme Settings.
 *
 * @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
 * 
 * @param WP_Customize_Manager $wp_customize Object that holds the customizer data.
 */
function theme_slug_register_customizer_panels($wp_customize)
{
    /*
     * Failsafe is safe
     */
    if (!isset($wp_customize)) {
        return;
    }
    /**
     * Add Panel for General Settings.
     * 
     * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
     * @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
     */
    $wp_customize->add_panel('theme_slug_panel_general', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name General Settings', 'theme-slug'), 'description' => __('Configure general settings for the Theme Name Theme', 'theme-slug')));
    /**
     * Add Panel for Color and Layout Settings.
     * 
     * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
     * @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
     */
    $wp_customize->add_panel('theme_slug_panel_colorslayouts', array('priority' => 11, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name Colors and Layouts', 'theme-slug'), 'description' => __('Configure color and layout settings for the Theme Name Theme', 'theme-slug')));
    /**
     * Add Panel for Advanced Settings.
     * 
     * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
     * @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
     */
    $wp_customize->add_panel('theme_slug_panel_advanced', array('priority' => 12, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name Advanced Settings', 'theme-slug'), 'description' => __('Configure advanced settings for the Theme Name Theme', 'theme-slug')));
}
Пример #2
1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function tesseract_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_panel('tesseract_general_options', array('priority' => 3, 'capability' => 'edit_theme_options', 'title' => 'General'));
    $wp_customize->add_panel('tesseract_header_options', array('priority' => 4, 'capability' => 'edit_theme_options', 'title' => 'Header Options'));
    $wp_customize->add_panel('tesseract_footer_options', array('priority' => 5, 'capability' => 'edit_theme_options', 'title' => 'Footer Options'));
    $wp_customize->add_panel('tesseract_layout', array('priority' => 7, 'capability' => 'edit_theme_options', 'title' => 'Layout Options'));
    $wp_customize->add_panel('tesseract_social', array('priority' => 8, 'capability' => 'edit_theme_options', 'title' => 'Social'));
    $wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
    $wp_customize->get_section('title_tagline')->priority = 3;
    if ($wp_customize->get_section('static_front_page')) {
        $wp_customize->get_section('static_front_page')->panel = 'tesseract_general_options';
        $wp_customize->get_section('static_front_page')->priority = 4;
    }
    $wp_customize->get_section('background_image')->panel = 'tesseract_general_options';
    $wp_customize->get_section('background_image')->priority = 2;
    $wp_customize->get_section('colors')->panel = 'tesseract_general_options';
    $wp_customize->get_section('colors')->title = __('Background Color', 'tesseract');
    $wp_customize->get_section('colors')->priority = 1;
    $wp_customize->get_control('background_color')->label = __('Choose a background color', 'tesseract');
    $wp_customize->get_control('background_color')->description = __('(This is only for the site\'s generic background color. You can define header and footer background colors in the Header Options and Footer Options respectively.)', 'tesseract');
    $wp_customize->remove_section('header_image');
    $wp_customize->remove_section('nav');
    $wp_customize->remove_control('header_textcolor');
    require get_template_directory() . '/inc/sections/header-colors.php';
    require get_template_directory() . '/inc/sections/header-logo.php';
    require get_template_directory() . '/inc/sections/header-size.php';
    require get_template_directory() . '/inc/sections/header-menu.php';
    require get_template_directory() . '/inc/sections/header-content.php';
    require get_template_directory() . '/inc/sections/mobile-menu.php';
    require get_template_directory() . '/inc/sections/social/account01.php';
    require get_template_directory() . '/inc/sections/social/account02.php';
    require get_template_directory() . '/inc/sections/social/account03.php';
    require get_template_directory() . '/inc/sections/social/account04.php';
    require get_template_directory() . '/inc/sections/social/account05.php';
    require get_template_directory() . '/inc/sections/social/account06.php';
    require get_template_directory() . '/inc/sections/social/account07.php';
    require get_template_directory() . '/inc/sections/social/account08.php';
    require get_template_directory() . '/inc/sections/social/account09.php';
    require get_template_directory() . '/inc/sections/social/account10.php';
    require get_template_directory() . '/inc/sections/blog.php';
    require get_template_directory() . '/inc/sections/search-results.php';
    require get_template_directory() . '/inc/sections/footer-colors.php';
    require get_template_directory() . '/inc/sections/footer-size.php';
    require get_template_directory() . '/inc/sections/footer-logo.php';
    require get_template_directory() . '/inc/sections/footer-content.php';
    require get_template_directory() . '/inc/sections/woocommerce.php';
    //if ( $wp_customize->is_preview() && ! is_admin() )
    //add_action( 'wp_footer', 'tesseract_customize_preview', 21);
}
Пример #3
1
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Honos 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function honos_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
    $wp_customize->get_section('background_image')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Rename the label to "Site Title Color" because this only affects the site title in this theme.
    $wp_customize->get_control('header_textcolor')->label = esc_html__('Site Title Color', 'honos');
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = esc_html__('Display Site Title & Tagline', 'honos');
    $wp_customize->get_section('header_image')->title = esc_html__('Logo', 'honos');
    // Add Theme Options panel and configure settings inside it
    $wp_customize->add_panel('honos_theme_options_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => esc_html__('Theme Options', 'honos'), 'description' => esc_html__('You can configure your theme settings here', 'honos')));
    $wp_customize->add_section('honos_header_call_us', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Call us', 'honos'), 'description' => esc_html__('Here you\'re able to configure your header call us link.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_header_call_us_text', array('default' => esc_html__('Call us:', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_call_us_text', array('label' => esc_html__('Call us text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_call_us_link', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('honos_header_call_us_link', array('label' => esc_html__('Call us link', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_call_us_link_text', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_call_us_link_text', array('label' => esc_html__('Call us link text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    // Consult
    $wp_customize->add_section('honos_header_consult', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Consult', 'honos'), 'description' => esc_html__('Consult text at the header.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_header_consult_text', array('default' => esc_html__('Request a free consultation', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_consult_text', array('label' => esc_html__('Consult text', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_consult_text_link', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('honos_header_consult_text_link', array('label' => esc_html__('Consult link', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
    // Footer columns
    $wp_customize->add_section('honos_footer_columns', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Footer columns', 'honos'), 'description' => esc_html__('Footer column count.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_footer_column_count', array('default' => '4', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('honos_footer_column_count', array('label' => esc_html__('Footer columns', 'honos'), 'section' => 'honos_footer_columns', 'type' => 'select', 'choices' => array('1' => esc_html__('1 column', 'honos'), '2' => esc_html__('2 columns', 'honos'), '3' => esc_html__('3 columns', 'honos'), '4' => esc_html__('4 columns', 'honos'))));
}
Пример #4
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Longform 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function longform_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'longform');
    $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'longform');
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Rename the label to "Site Title Color" because this only affects the site title in this theme.
    $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'longform');
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = __('Display Site Title & 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'));
}
Пример #5
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Blogpost 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function blogpost_customizer_register($wp_customize)
{
    // Add General setting panel and configure settings inside it
    $wp_customize->add_panel('blogpost_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'blogpost-lite'), 'description' => __('You can configure your general theme settings here', 'blogpost-lite')));
    // Add 404 setting panel and configure settings inside it
    $wp_customize->add_panel('blogpost_404_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('404 page', 'blogpost-lite'), 'description' => __('You can configure your themes 404 page settings here.', 'blogpost-lite')));
    // Website logo
    $wp_customize->add_section('blogpost_general_logo', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Website logo', 'blogpost-lite'), 'description' => __('Please upload your logo, recommended logo size should be between 262x80', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_logo', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blogpost_logo', array('label' => __('Website logo', 'blogpost-lite'), 'section' => 'blogpost_general_logo', 'settings' => 'blogpost_logo')));
    // Logo retina ready
    $wp_customize->add_setting('blogpost_logo_retina_ready', array('sanitize_callback' => 'blogpost_sanitize_checkbox'));
    $wp_customize->add_control('blogpost_logo_retina_ready', array('label' => 'Website logo is Retina ready', 'description' => 'You have to uplaod website logo which is 2x in dimensions. It will automatically scaled down for normal displays and prepared for High resolution displays.', 'section' => 'blogpost_general_logo', 'type' => 'checkbox'));
    // Page layout
    $wp_customize->add_section('blogpost_general_layout', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Layout', 'blogpost-lite'), 'description' => __('Select a layout style.<br />(full, left side sidebar, right side sidebar)', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_layout', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_layout', array('type' => 'radio', 'label' => 'Layout', 'section' => 'blogpost_general_layout', 'choices' => array('full' => 'Full', 'right' => 'Right')));
    // Search background
    $wp_customize->add_section('blogpost_general_search_bg', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Search background', 'blogpost-lite'), 'description' => __('Upload an image to use as your search background', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_search_background', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blogpost_search_background', array('label' => __('Search background', 'blogpost-lite'), 'section' => 'blogpost_general_search_bg', 'settings' => 'blogpost_search_background')));
    // Show comments at sidebar
    $wp_customize->add_section('blogpost_general_sidebar_comments', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Show comments at sidebar', 'blogpost-lite'), 'description' => __('Remove comment form bottom of the post and relocate it at sidebar.', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_sidebar_comments', array('sanitize_callback' => 'blogpost_sanitize_checkbox'));
    $wp_customize->add_control('blogpost_sidebar_comments', array('label' => 'Show comments at sidebar', 'section' => 'blogpost_general_sidebar_comments', 'type' => 'checkbox'));
    // Side menu image
    $wp_customize->add_section('blogpost_general_side_image', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Side menu image', 'blogpost-lite'), 'description' => __('Upload an image to use as your side menu background', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_side_menu_img', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blogpost_side_menu_img', array('label' => __('Side menu image', 'blogpost-lite'), 'section' => 'blogpost_general_side_image', 'settings' => 'blogpost_side_menu_img')));
    // Blog columns
    $wp_customize->add_section('blogpost_general_blog_columns', array('priority' => 70, 'capability' => 'edit_theme_options', 'title' => __('Blog columns', 'blogpost-lite'), 'description' => __('Select in how many columns will the blog posts be divided.', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_blog_columns', array('default' => '3', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_blog_columns', array('type' => 'select', 'label' => 'Blog columns', 'section' => 'blogpost_general_blog_columns', 'choices' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6')));
    // Scroll to top
    $wp_customize->add_section('blogpost_general_scrolltotop', array('priority' => 100, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'blogpost-lite'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_scrolltotop', array('sanitize_callback' => 'blogpost_sanitize_checkbox'));
    $wp_customize->add_control('blogpost_scrolltotop', array('label' => 'Scroll to top', 'section' => 'blogpost_general_scrolltotop', 'type' => 'checkbox'));
    // Featured post
    $wp_customize->add_section('blogpost_featured_post', array('priority' => 110, 'capability' => 'edit_theme_options', 'title' => __('Featured post', 'blogpost-lite'), 'description' => __('The ID of the featured post to show at the front page.', 'blogpost-lite'), 'panel' => 'blogpost_general_panel'));
    $wp_customize->add_setting('blogpost_featured_post_id', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_featured_post_id', array('label' => 'Featured post', 'section' => 'blogpost_featured_post', 'type' => 'text'));
    // 404 page title
    $wp_customize->add_section('blogpost_404_page_title', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('404 Page Title', 'blogpost-lite'), 'description' => __('Set the page title that is displayed on the 404 Error Page.', 'blogpost-lite'), 'panel' => 'blogpost_404_panel'));
    $wp_customize->add_setting('blogpost_404_title', array('default' => 'This is somewhat embarrassing, isn\'t it?', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_404_title', array('label' => '404 Page Title', 'section' => 'blogpost_404_page_title', 'type' => 'text'));
    // 404 page message
    $wp_customize->add_section('blogpost_404_page_message', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('404 Page Message', 'blogpost-lite'), 'description' => __('Set the message that is displayed on the 404 Error Page.', 'blogpost-lite'), 'panel' => 'blogpost_404_panel'));
    $wp_customize->add_setting('blogpost_404_message', array('default' => 'It seems we can\'t find what you\'re looking for. Perhaps searching, or one of the links below, can help.', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_404_message', array('label' => '404 Page Title', 'section' => 'blogpost_404_page_message', 'type' => 'text'));
    // Social links
    $wp_customize->add_section(new blogpost_Customized_Section($wp_customize, 'blogpost_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
    $wp_customize->add_setting('blogpost_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('blogpost_fake_field', array('label' => '', 'section' => 'blogpost_social_links', 'type' => 'text'));
}
Пример #6
0
/**
 * 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';
}
Пример #7
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Boron 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function boron_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'boron');
    $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'boron');
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Rename the label to "Site Title Color" because this only affects the site title in this theme.
    $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'boron');
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = __('Display Site Title &amp; Tagline', 'boron');
    // Add General setting panel and configure settings inside it
    $wp_customize->add_panel('boron_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'boron'), 'description' => __('You can configure your general theme settings here', 'boron')));
    // Add navigation setting panel and configure settings inside it
    $wp_customize->add_panel('boron_navigation_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('Side navigation settings', 'boron'), 'description' => __('You can configure your theme side navigation settings here.', 'boron')));
    // Scroll to top
    $wp_customize->add_section('boron_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'boron'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'boron'), 'panel' => 'boron_general_panel'));
    $wp_customize->add_setting('boron_scrolltotop', array('sanitize_callback' => 'boron_sanitize_checkbox'));
    $wp_customize->add_control('boron_scrolltotop', array('label' => __('Scroll to top', 'boron'), 'section' => 'boron_general_scrolltotop', 'type' => 'checkbox'));
    // Post background
    $wp_customize->add_section('boron_post_bg', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Post background', 'boron'), 'description' => __('Do you want your own post background? You can change it here.', 'boron'), 'panel' => 'boron_general_panel'));
    $wp_customize->add_setting('boron_post_background', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_post_background', array('label' => __('Post background', 'boron'), 'section' => 'boron_post_bg', 'settings' => 'boron_post_background')));
    // Comment position
    $wp_customize->add_section('boron_post_comments', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post comments', 'boron'), 'description' => __('Choose where to show post comments.', 'boron'), 'panel' => 'boron_general_panel'));
    $wp_customize->add_setting('boron_comment_location', array('default' => 'side', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('boron_comment_location', array('label' => __('Post comments position', 'boron'), 'section' => 'boron_post_comments', 'type' => 'select', 'choices' => array('side' => 'Right side', 'bottom' => 'After post content')));
    // Grid size
    $wp_customize->add_section('boron_grid_size', array('priority' => 60, 'capability' => 'edit_theme_options', 'title' => __('Post grid size', 'boron'), 'description' => __('Choose how many columns will there be at the post grid.', 'boron'), 'panel' => 'boron_general_panel'));
    $wp_customize->add_setting('boron_grid_columns', array('default' => '4', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('boron_grid_columns', array('label' => __('Post grid size', 'boron'), 'section' => 'boron_grid_size', 'type' => 'select', 'choices' => array('2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6')));
    // Background
    $wp_customize->add_section('boron_navigation_bg', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Navigation background', 'boron'), 'description' => __('Do you want your own navigation background? You can change it here.', 'boron'), 'panel' => 'boron_navigation_panel'));
    $wp_customize->add_setting('boron_navigation_background', array('sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() . '/images/navigation-bg.png'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'boron_navigation_background', array('label' => __('Navigation background', 'boron'), 'section' => 'boron_navigation_bg', 'settings' => 'boron_navigation_background')));
    // Navigation title
    $wp_customize->add_section('boron_navigation_title', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Navigation title', 'boron'), 'description' => __('Title for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel'));
    $wp_customize->add_setting('boron_nav_title', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('boron_nav_title', array('label' => __('Navigation title', 'boron'), 'section' => 'boron_navigation_title', 'type' => 'text'));
    // Navigation description
    $wp_customize->add_section('boron_navigation_description', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Navigation description', 'boron'), 'description' => __('Description for the side navigation.', 'boron'), 'panel' => 'boron_navigation_panel'));
    $wp_customize->add_setting('boron_nav_description', array('sanitize_callback' => 'boron_sanitize_textarea'));
    $wp_customize->add_control('boron_nav_description', array('label' => __('Navigation description', 'boron'), 'section' => 'boron_navigation_description', 'type' => 'textarea'));
    // Social links
    $wp_customize->add_section(new boron_Customized_Section($wp_customize, 'boron_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
    $wp_customize->add_setting('boron_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('boron_fake_field', array('label' => '', 'section' => 'boron_social_links', 'type' => 'text'));
}
Пример #8
0
 /**
  * This hooks into 'customize_register' (available as of WP 3.4) and allows
  * you to add new sections and controls to the Theme Customize screen.
  *
  * Note: To enable instant preview, we have to actually write a bit of custom
  * javascript. See live_preview() for more.
  *
  * @see add_action('customize_register',$func)
  * @param \WP_Customize_Manager $wp_customize
  * @since blank-theme 1.0
  */
 public static function register($wp_customize)
 {
     /*==============================
             Site title & Tagline
       ===============================*/
     //Logo
     $wp_customize->add_setting('blank_theme_logo', array('default' => "", 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blank_theme_logo', array('label' => __('Choose Site Logo', 'blank-theme'), 'section' => 'title_tagline', 'settings' => 'blank_theme_logo', 'description' => __('Remove logo to display site title.', 'blank-theme'))));
     //Hide tagline
     $wp_customize->add_setting('blank_theme_hide_tagline', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blank_theme_sanitize_checkboxes'));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blank_theme_hide_tagline', array('label' => __('Hide Tagline', 'blank-theme'), 'section' => 'title_tagline', 'settings' => 'blank_theme_hide_tagline', 'type' => 'checkbox')));
     /************************** GENERAL ***************************/
     $wp_customize->add_panel('blank_theme_general_panel', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('General', 'blank-theme')));
     /*==============================
                 SIDEBAR POSITIONS
       ===============================*/
     $wp_customize->add_section('blank_theme_sidebar_position_section', array('title' => __('Sidebar Position', 'blank-theme'), 'capability' => 'edit_theme_options', 'description' => __('', 'blank-theme'), 'panel' => 'blank_theme_general_panel'));
     $wp_customize->add_setting('blank_theme_sidebar_position', array('default' => 'right', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blank_theme_sanitize_choices'));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blank_theme_sidebar_position', array('label' => __('Sidebar Position', 'blank-theme'), 'section' => 'blank_theme_sidebar_position_section', 'settings' => 'blank_theme_sidebar_position', 'type' => 'radio', 'choices' => array('left' => __('Left', 'blank-theme'), 'right' => __('Right', 'blank-theme')))));
     /*==============================
             Footer Copyright Text
       ===============================*/
     $wp_customize->add_section('blank_theme_copyright_text_section', array('title' => __('Copyright Text', 'blank-theme'), 'capability' => 'edit_theme_options', 'description' => __('Will override the footer copyright text', 'blank-theme'), 'panel' => 'blank_theme_general_panel'));
     //SPECIAL FONTS
     $wp_customize->add_setting('blank_theme_copyright_text', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
     $wp_customize->add_control('blank_theme_copyright_text', array('label' => __('Copyright Text', 'blank-theme'), 'section' => 'blank_theme_copyright_text_section', 'settings' => 'blank_theme_copyright_text', 'type' => 'text'));
     /*==============================
                 SLIDER
       ===============================*/
     $wp_customize->add_panel('blank_theme_pannel', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Slider Options', 'blank-theme'), 'description' => __('Add slider', 'blank-theme')));
     for ($i = 1; $i <= 8; $i++) {
         $wp_customize->add_section('blank_theme_section_' . $i, array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => sprintf(__('Slide %s', 'blank-theme'), $i), 'description' => __('Add slide', 'blank-theme'), 'panel' => 'blank_theme_pannel'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][title]', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][title]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Title', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][title]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][description]', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][description]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Description', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][description]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][link]', array('default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][link]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Link', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][link]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][image]', array('default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blank_theme_slides[' . $i . '][image]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Image', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][image]')));
     }
     //4. We can also change built-in settings by modifying properties. For instance, let's make some stuff use live preview JS...
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $wp_customize->get_setting('background_color')->transport = 'postMessage';
     $wp_customize->remove_control('header_image');
     //$wp_customize->remove_control('header_textcolor');
 }
Пример #9
0
/**
 * Registers custom panels for the Customizer
 *
 * @see			add_action( 'customize_register', $func )
 * @param 		WP_Customize_Manager 		$wp_customize 		Theme Customizer object.
 * @link 		http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
 * @since 		1.0.0
 */
function dpd_2015_register_panels($wp_customize)
{
    // Theme Options Panel
    $wp_customize->add_panel('theme_options', array('capability' => 'edit_theme_options', 'description' => esc_html__('Options for DPD 2015', 'dpd-2015'), 'priority' => 10, 'theme_supports' => '', 'title' => esc_html__('Theme Options', 'dpd-2015')));
    // Programs Menu Panel
    /*$wp_customize->add_panel( 'programs_menu',
    		array(
    			'capability'  		=> 'edit_theme_options',
    			'description'  		=> esc_html__( 'Links to the subsites', 'dpd-2015' ),
    			'priority'  		=> 10,
    			'theme_supports'  	=> '',
    			'title'  			=> esc_html__( 'Programs Menu', 'dpd-2015' ),
    		)
    	);*/
    /*
    // Theme Options Panel
    $wp_customize->add_panel( 'theme_options',
    	array(
    		'capability'  		=> 'edit_theme_options',
    		'description'  		=> esc_html__( 'Options for DPD 2015', 'dpd-2015' ),
    		'priority'  		=> 10,
    		'theme_supports'  	=> '',
    		'title'  			=> esc_html__( 'Theme Options', 'dpd-2015' ),
    	)
    );
    */
}
 /**
  * Handle a panel entry
  *
  * @param $id
  * @param array $data
  * @param array|null $sections
  */
 public function setPanel($id, array $data, array $sections = null)
 {
     $panel_data = $this->getPanelData($data);
     if (is_null($sections) && isset($data['sections'])) {
         $sections = $data['sections'];
     }
     $item = $this->customizer->get_panel($id);
     if ($item) {
         foreach ($data as $var => $val) {
             if (array_key_exists($var, $panel_data)) {
                 $item->{$var} = $val;
             }
         }
         if (isset($data['delete']) && $data['delete'] === true) {
             $this->customizer->remove_panel($id);
         }
     } else {
         $this->customizer->add_panel(new WP_Customize_Panel($this->customizer, $id, $panel_data));
     }
     if (!is_null($sections)) {
         $sections['object'] = 'sections';
         $sections['panel'] = $id;
         $this->processData($sections);
     }
 }
Пример #11
0
 /**
  * Create all panels and sections
  *
  * @param \WP_Customize_Manager $wp_customize the WP customizer
  * @return \WP_Customize_Manager
  */
 public function createPanels($wp_customize)
 {
     $data = $this->getData();
     // Move all default sections to the default panel
     $defaultPanel = $data['options']['default_panel'];
     $wp_customize->add_panel($defaultPanel['id'], array('priority' => 10, 'title' => Strings::translate($defaultPanel['title']), 'description' => ''));
     $existingSections = $wp_customize->sections();
     /** @var \WP_Customize_Section $section */
     foreach ($existingSections as $sectionId => $section) {
         if (empty($section->panel)) {
             $section->panel = $defaultPanel['id'];
         }
     }
     // Define additional panels and sections
     $panels = $data['panels'];
     $panelPriority = 1000;
     foreach ($panels as $panelProps) {
         if (isset($panelProps['title'])) {
             $panelId = 'panel-' . $panelPriority;
             $wp_customize->add_panel($panelId, array('priority' => $panelPriority, 'title' => Strings::translate($panelProps['title']), 'description' => Strings::translate($panelProps['description'])));
         } else {
             $panelId = $defaultPanel['id'];
         }
         $sectionPriority = 10;
         foreach ($panelProps['sections'] as $sectionId => $sectionProps) {
             $wp_customize->add_section($sectionId, array('panel' => $panelId, 'priority' => $sectionPriority, 'title' => Strings::translate($sectionProps['title']), 'description' => Strings::translate($sectionProps['description'])));
             $sectionPriority += 10;
         }
         $panelPriority += 10;
     }
     return $wp_customize;
 }
 /**
  * Register Customizer routine.
  *
  * @param \WP_Customize_Manager $wp_customize Manager.
  */
 public function customizer(WP_Customize_Manager $wp_customize)
 {
     if (!isset($wp_customize->selective_refresh)) {
         return;
     }
     $wp_customize->add_panel('wpsc', array('title' => __('Store', 'wp-e-commerce'), 'description' => __('Presentational settings for your store.', 'wp-e-commerce'), 'priority' => 150));
     foreach ($this->sections as $name => $label) {
         $wp_customize->add_section($name, array('title' => $label, 'panel' => 'wpsc'));
     }
     foreach ($this->settings as $name => $settings) {
         $wp_customize->add_setting($name, $settings['setting']);
         if (isset($settings['control']['class']) && 'WP_Customize_Control' === get_parent_class($settings['control']['class'])) {
             $class = $settings['control']['class'];
             foreach ($settings['control']['settings'] as $s) {
                 $wp_customize->add_setting($s, $settings['setting']);
             }
             $wp_customize->add_control(new $class($wp_customize, $name, array('label' => $settings['control']['label'], 'section' => $settings['control']['section'], 'settings' => $settings['control']['settings'])));
         } else {
             $wp_customize->add_control($name, $settings['control']);
         }
         if (isset($settings['partial'])) {
             $wp_customize->selective_refresh->add_partial($name, $settings['partial']);
         }
     }
 }
Пример #13
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function bbird_under_customize_register($wp_customize)
{
    $wp_customize->add_panel('footer_panel', array('priority' => 120, 'capability' => 'edit_theme_options', 'title' => __('Footer', 'bbird-under')));
    $wp_customize->add_section('footer_widgets', array('title' => __('Widget options', 'bbird-under'), 'priority' => 12, 'panel' => 'footer_panel'));
    $wp_customize->add_setting('footer_widgets', array('default' => 'no', 'sanitize_callback' => 'bbird_under_sanitize_select'));
    $wp_customize->add_control('footer_widgets', array('type' => 'radio', 'label' => __('Choose the number of footer widgets', 'bbird-under'), 'section' => 'footer_widgets', 'choices' => array('no' => __('No widgets', 'bbird-under'), 'one' => __('One (Full width)', 'bbird-under'), 'two' => __('Two (One Half)', 'bbird-under'), 'three' => __('Three (One-third layout)', 'bbird-under'), 'four' => __('Four (One-fourth layout)', 'bbird-under'))));
}
Пример #14
0
 /**
  * Sets up the AMP Customizer preview.
  */
 public function register_ui()
 {
     add_action('customize_controls_enqueue_scripts', array($this, 'add_customizer_scripts'));
     add_filter('customize_previewable_devices', array($this, 'force_mobile_preview'));
     $this->wp_customize->add_panel(self::PANEL_ID, array('type' => 'amp', 'title' => __('AMP', 'amp'), 'description' => sprintf(__('<a href="%s" target="_blank">The AMP Project</a> is a Google-led initiative that dramatically improves loading speeds on phones and tablets. You can use the Customizer to preview changes to your AMP template before publishing them.', 'amp'), 'https://ampproject.org')));
     do_action('amp_customizer_register_ui', $this->wp_customize);
 }
/**
 * 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);
    }
}
Пример #16
0
/**
 * Register customizer
 *
 * @param WP_Customize_Manager $wp_customize
 */
function mwt_customizer_register($wp_customize)
{
    /**
     * -----------------------------------------
     * GENERAL PANEL
     * -----------------------------------------
     */
    $wp_customize->add_panel('mwt_general_panel', array('priority' => 1, 'capability' => 'edit_theme_options', 'title' => __('General Options', 'mwt')));
    //Head section
    $wp_customize->add_section('mwt_general_head', array('priority' => 1, 'panel' => 'mwt_general_panel', 'title' => __('Head', 'mwt')));
    //Head Title
    $wp_customize->add_setting('mwt_general_head_title', array('sanitize_callback' => 'mwt_sanitize_text'));
    $wp_customize->add_control('mwt_general_head_title', array('label' => __('Title', 'mwt'), 'section' => 'mwt_general_head', 'setting' => 'mwt_general_head_title'));
    // Head Subtitle
    $wp_customize->add_setting('mwt_general_head_subtitle', array('sanitize_callback' => 'mwt_sanitize_text'));
    $wp_customize->add_control('mwt_general_head_subtitle', array('label' => __('Subtitle', 'mwt'), 'section' => 'mwt_general_head', 'setting' => 'mwt_general_head_subtitle'));
    //Head logo
    $wp_customize->add_setting('mwt_general_head_logo', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'mwt_general_head_logo', array('label' => __('Logo', 'mwt'), 'section' => 'mwt_general_head', 'setting' => 'mwt_general_head_logo')));
    //Social section
    $wp_customize->add_section('mwt_general_social', array('panel' => 'mwt_general_panel', 'title' => __('Social', 'mwt')));
    // Facebook link
    $wp_customize->add_setting('mwt_general_social_facebook', array('sanitize_callback' => 'esc_url_raw', 'default' => '#'));
    $wp_customize->add_control('mwt_general_social_facebook', array('label' => __('Facebook Link', 'mwt'), 'section' => 'mwt_general_social', 'setting' => 'mwt_general_social_facebook'));
    // Linked in
    $wp_customize->add_setting('mwt_general_social_linked', array('sanitize_callback' => 'esc_url_raw', 'default' => '#'));
    $wp_customize->add_control('mwt_general_social_linked', array('label' => __('Linked In', 'mwt'), 'section' => 'mwt_general_social', 'setting' => 'mwt_general_social_linked'));
    // Twitter link
    $wp_customize->add_setting('mwt_general_social_twitter', array('sanitize_callback' => 'esc_url_raw', 'default' => '#'));
    $wp_customize->add_control('mwt_general_social_twitter', array('label' => __('Twitter Link', 'mwt'), 'section' => 'mwt_general_social', 'setting' => 'mwt_general_social_twitter'));
    /**
     *----------------------------------------
     * CUSTOMERS PANEL
     *----------------------------------------
     */
    $wp_customize->add_panel('mwt_customers_panel', array('priority' => 32, 'capability' => 'edit_theme_options', 'title' => __('Customers Section', 'mwt')));
    $wp_customize->add_section('mwt_customers_content', array('title' => __('Content', 'mwt'), 'panel' => 'mwt_customers_panel'));
    $wp_customize->add_setting('mwt_customers_content_title', array('sanitize_callback' => 'mwt_sanitize_text'));
    $wp_customize->add_control('mwt_customers_content_title', array('label' => __('Title', 'mwt'), 'section' => 'mwt_customers_content', 'setting' => 'mwt_customers_content_title'));
    $wp_customize->add_setting('mwt_customers_content_subtitle', array('sanitize_callback' => 'mwt_sanitize_text'));
    $wp_customize->add_control('mwt_customers_content_subtitle', array('label' => __('Subtitle', 'mwt'), 'section' => 'mwt_customers_content', 'setting' => 'mwt_customers_content_subtitle'));
}
Пример #17
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function e_commerce_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';
    //Theme Options
    $wp_customize->add_panel('e_commerce_theme_options', array('description' => __('Basic theme Options', 'e-commerce'), 'capability' => 'edit_theme_options', 'priority' => 200, 'title' => __('Theme Options', 'e-commerce')));
    // Custom CSS Option
    $wp_customize->add_section('e_commerce_custom_css', array('description' => __('Custom/Inline CSS', 'e-commerce'), 'panel' => 'e_commerce_theme_options', 'priority' => 1, 'title' => __('Custom CSS Options', 'e-commerce')));
    $wp_customize->add_setting('custom_css', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'e_commerce_sanitize_custom_css'));
    $wp_customize->add_control('custom_css', array('label' => __('Enter Custom CSS', 'e-commerce'), 'priority' => 1, 'section' => 'e_commerce_custom_css', 'settings' => 'custom_css', 'type' => 'textarea'));
}
 /**
  * @ticket 37128
  */
 function test_prepare_controls_wp_list_sort_panels()
 {
     wp_set_current_user(self::$admin_user_id);
     $panels = array('foo' => 2, 'bar' => 4, 'foobar' => 3, 'key' => 1);
     $panels_sorted = array('key', 'foo', 'foobar', 'bar');
     foreach ($panels as $panel_id => $priority) {
         $this->manager->add_panel($panel_id, array('priority' => $priority));
     }
     $this->manager->prepare_controls();
     $result = $this->manager->panels();
     $this->assertEquals($panels_sorted, array_keys($result));
 }
Пример #19
0
/**
 * Add new fields to customizer, create panel 'Other' and 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_other($wp_customize)
{
    $defaults = sgwindow_get_defaults();
    $wp_customize->add_panel('other', array('priority' => 106, 'title' => __('Customize Other Settings', 'sg-window'), 'description' => __('All other settings.', 'sg-window')));
    $section_priority = 10;
    //New section in customizer: Logotype
    $wp_customize->add_section('sgwindow_theme_logotype', array('title' => __('Logotype', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other'));
    //New setting in Logotype section: Logo Image
    $wp_customize->add_setting('logotype_url', array('default' => get_template_directory_uri() . '/img/logo.png', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_url'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logotype_url', array('label' => __('Logotype Image', 'sg-window'), 'section' => 'sgwindow_theme_logotype', 'settings' => 'logotype_url', 'priority' => '1')));
    //New section in customizer: Fixed Background
    $wp_customize->add_section('column_background_url', array('title' => __('Fixed Background', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'background'));
    //column background image
    $wp_customize->add_setting('column_background_url', array('default' => $defaults['column_background_url'], 'transport' => 'postMessage', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_background_url'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'column_background_url', array('label' => __('Site Background', 'sg-window'), 'section' => 'column_background_url', 'settings' => 'column_background_url', 'priority' => 1)));
    //background position
    $wp_customize->add_setting('top', array('default' => $defaults['top'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_background_position'));
    $wp_customize->add_control('top', array('label' => __('Vertical position', 'sg-window'), 'section' => 'column_background_url', 'settings' => 'top', 'type' => 'select', 'priority' => 2, 'choices' => array('top' => __('Top', 'sg-window'), 'center' => __('Center', 'sg-window'), 'bottom' => __('Bottom', 'sg-window'))));
    //New section in customizer: Navigation Options
    $wp_customize->add_section('sgwindow_nav_options', array('title' => __('Navigation menu settings', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'navigation'));
    //New setting in Navigation section: Switch On First Top Menu
    $wp_customize->add_setting('is_show_top_menu', array('default' => $defaults['is_show_top_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('is_show_top_menu', array('label' => __('Switch On First Top Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_top_menu', 'type' => 'checkbox', 'priority' => $section_priority++, 'panel' => 'other'));
    //New setting in Navigation section: Switch On Second Top Menu
    $wp_customize->add_setting('is_show_secont_top_menu', array('default' => $defaults['is_show_secont_top_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('sgwindow_is_show_secont_top_menu', array('label' => __('Switch On Second Top Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_secont_top_menu', 'type' => 'checkbox', 'priority' => 22));
    //New setting in Navigation section: Switch On Footer Menu
    $wp_customize->add_setting('is_show_footer_menu', array('default' => $defaults['is_show_footer_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('sgwindow_is_show_footer_menu', array('label' => __('Switch On Footer Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_footer_menu', 'type' => 'checkbox', 'priority' => 23));
    //New section in the customizer: Scroll To Top Button
    $wp_customize->add_section('sgwindow_scroll', array('title' => __('Scroll To Top Button', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other'));
    $wp_customize->add_setting('scroll_button', array('default' => $defaults['scroll_button'], 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'sgwindow_sanitize_scroll_button'));
    $wp_customize->add_control('scroll_button', array('label' => __('How to display the scroll to top button', 'sg-window'), 'section' => 'sgwindow_scroll', 'settings' => 'scroll_button', 'type' => 'select', 'priority' => 1, 'choices' => array('none' => __('None', 'sg-window'), 'right' => __('Right', 'sg-window'), 'left' => __('Left', 'sg-window'), 'center' => __('Center', 'sg-window'))));
    $wp_customize->add_setting('scroll_animate', array('default' => $defaults['scroll_animate'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_scroll_effect'));
    $wp_customize->add_control('scroll_animate', array('label' => __('How to animate the scroll to top button', 'sg-window'), 'section' => 'sgwindow_scroll', 'settings' => 'scroll_animate', 'type' => 'select', 'priority' => 1, 'choices' => array('none' => __('None', 'sg-window'), 'move' => __('Jump', 'sg-window'))));
    //New section in the customizer: Favicon
    $wp_customize->add_section('sgwindow_favicon', array('title' => __('Favicon', 'sg-window'), 'description' => __('You can select an Icon to be shown at the top of browser window by uploading from your computer. (Size: [16X16] px)', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other'));
    $wp_customize->add_setting('favicon', array('default' => $defaults['favicon'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_url'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'favicon', array('label' => __('Favicon', 'sg-window'), 'section' => 'sgwindow_favicon', 'settings' => 'favicon', 'priority' => '1')));
    sgwindow_create_social_icons_section($wp_customize);
    $wp_customize->add_setting('is_header_on_front_page_only', array('default' => $defaults['is_header_on_front_page_only'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('is_header_on_front_page_only', array('label' => __('Display Header Image on the Front Page only', 'sg-window'), 'section' => 'header_image', 'settings' => 'is_header_on_front_page_only', 'type' => 'checkbox', 'priority' => 40));
    $wp_customize->add_setting('is_text_on_front_page_only', array('default' => $defaults['is_text_on_front_page_only'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('is_text_on_front_page_only', array('label' => __('Display Header Text on the Front Page only', 'sg-window'), 'section' => 'header_image', 'settings' => 'is_text_on_front_page_only', 'type' => 'checkbox', 'priority' => 41));
    $wp_customize->add_section('check', array('title' => __('--', 'sg-window'), 'priority' => 200, 'panel' => 'other'));
    if ('' == sgwindow_get_theme_mod('are_we_saved', '')) {
        $wp_customize->add_setting('are_we_saved', array('type' => 'theme_mod', 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
        $wp_customize->add_control('are_we_saved', array('label' => __('--', 'sg-window'), 'section' => 'check', 'settings' => 'are_we_saved', 'type' => 'checkbox', 'priority' => 1));
    }
    $wp_customize->add_setting('max_id', array('type' => 'theme_mod', 'default' => '0', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('max_id', array('label' => __('Max id', 'sg-window'), 'section' => 'check', 'settings' => 'max_id', 'type' => 'input'));
}
 /**
  * Register the base Panel for Events Calendar Sections to be attached to
  *
  * @since 4.0
  *
  * @return WP_Customize_Panel
  */
 private function register_panel()
 {
     $panel = $this->manager->get_panel($this->ID);
     // If the Panel already exists we leave returning it's instance
     if (!empty($panel)) {
         return $panel;
     }
     $panel_args = apply_filters('tribe_events_pro_customizer_panel_args', array('title' => esc_html__('The Events Calendar', 'tribe-events-calendar-pro'), 'description' => esc_html__('Use the following panel of your customizer to change the styling of your Calendar and Event pages.', 'tribe-events-calendar-pro'), 'priority' => 125), $this->ID, $this);
     // Actually Register the Panel
     $this->manager->add_panel($this->ID, $panel_args);
     // Return the Panel instance
     return $this->manager->get_panel($this->ID);
 }
Пример #21
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function munsa_lite_customize_register($wp_customize)
{
    // Add the theme panel.
    $wp_customize->add_panel('theme', array('title' => esc_html__('Theme Settings', 'munsa-lite'), 'priority' => 10));
    // Load different part of the Customizer.
    require_once get_template_directory() . '/inc/customizer/classes/customizer-info-text.php';
    require_once get_template_directory() . '/inc/customizer/front-page.php';
    require_once get_template_directory() . '/inc/customizer/munsa-pro.php';
    // Use live preview on some fields.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
Пример #22
0
 /**
  * @see WP_Customize_Section::json()
  */
 function test_json()
 {
     $args = array('priority' => 200, 'capability' => 'edit_posts', 'theme_supports' => 'html5', 'title' => 'Hello World', 'description' => 'Lorem Ipsum', 'type' => 'horizontal', 'panel' => 'bar', 'active_callback' => '__return_true');
     $this->manager->add_panel('bar');
     $section = new WP_Customize_Section($this->manager, 'foo', $args);
     $data = $section->json();
     $this->assertEquals('foo', $data['id']);
     foreach (array('title', 'description', 'priority', 'panel', 'type') as $key) {
         $this->assertEquals($args[$key], $data[$key]);
     }
     $this->assertEmpty($data['content']);
     $this->assertTrue($data['active']);
     $this->assertInternalType('int', $data['instanceNumber']);
 }
Пример #23
0
/**
 * Registers custom panels for the Customizer
 *
 * @see			add_action( 'customize_register', $func )
 * @link 		http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
 * @since 		1.0.0
 *
 * @param 		WP_Customize_Manager 		$wp_customize 		Theme Customizer object.
 */
function slushman_2016_register_panels($wp_customize)
{
    // Theme Options Panel
    $wp_customize->add_panel('theme_options', array('capability' => 'edit_theme_options', 'description' => esc_html__('Options for Slushman 2016', 'slushman-2016'), 'priority' => 10, 'theme_supports' => '', 'title' => esc_html__('Theme Options', 'slushman-2016')));
    /*
    // Theme Options Panel
    $wp_customize->add_panel( 'theme_options',
    	array(
    		'capability'  		=> 'edit_theme_options',
    		'description'  		=> esc_html__( 'Options for Slushman 2016', 'slushman-2016' ),
    		'priority'  		=> 10,
    		'theme_supports'  	=> '',
    		'title'  			=> esc_html__( 'Theme Options', 'slushman-2016' ),
    	)
    );
    */
}
Пример #24
0
/**
 * Registers custom panels for the Customizer
 *
 * @see			add_action( 'customize_register', $func )
 * @param 		WP_Customize_Manager 		$wp_customize 		Theme Customizer object.
 * @link 		http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
 * @since 		1.0.0
 */
function function_names_register_panels($wp_customize)
{
    // Theme Options Panel
    $wp_customize->add_panel('theme_options', array('capability' => 'edit_theme_options', 'description' => esc_html__('Options for Replace With Theme Name', 'text-domain'), 'priority' => 10, 'theme_supports' => '', 'title' => esc_html__('Theme Options', 'text-domain')));
    /*
    // Theme Options Panel
    $wp_customize->add_panel( 'theme_options',
    	array(
    		'capability'  		=> 'edit_theme_options',
    		'description'  		=> esc_html__( 'Options for Replace With Theme Name', 'text-domain' ),
    		'priority'  		=> 10,
    		'theme_supports'  	=> '',
    		'title'  			=> esc_html__( 'Theme Options', 'text-domain' ),
    	)
    );
    */
}
Пример #25
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function hovercraft_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';
    /* Colors */
    $wp_customize->add_panel('hovercraft_colors', array('title' => __('Colors', 'hovercraft'), 'description' => 'Customize text, link, and background colors.', 'priority' => 100));
    $color_sections = array(array('header_colors', 'Header Colors', array(array('header_background_color', 'Header Background', '#eeeeee'), array('header_text_color', 'Header Text', '#000000'), array('header_link_color', 'Header Link', '#00554e'))), array('content_colors', 'Content Colors', array(array('content_background_color', 'Content Background', '#ffffff'), array('content_text_color', 'Content Text', '#000000'), array('content_link_color', 'Content Link', '#00554e'))), array('sidebar_colors', 'Sidebar Colors', array(array('sidebar_background_color', 'Sidebar Background', '#ffffff'), array('sidebar_text_color', 'Sidebar Text', '#000000'), array('sidebar_link_color', 'Sidebar Link', '#00554e'))), array('footer_colors', 'Footer Colors', array(array('footer_background_color', 'Footer Background', '#444444'), array('footer_text_color', 'Footer Text', '#ffffff'), array('footer_link_color', 'Footer Link', '#a1fff6'))));
    foreach ($color_sections as $color_section) {
        $section_id = 'hovercraft_' . $color_section[0];
        $section_name = $color_section[1];
        $section_settings = $color_section[2];
        $wp_customize->add_section($section_id, array('title' => __($section_name, 'hovercraft'), 'panel' => 'hovercraft_colors'));
        foreach ($section_settings as $color_setting) {
            $widget_id = $color_setting[0];
            $setting_id = 'hovercraft_' . $color_setting[0];
            $setting_name = $color_setting[1];
            $setting_default = $color_setting[2];
            $wp_customize->add_setting($setting_id, array('default' => $setting_default, 'sanitize_callback' => 'sanitize_hex_color'));
            $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $widget_id, array('label' => __($setting_name, 'hovercraft'), 'section' => $section_id, 'settings' => $setting_id)));
        }
    }
    /* Theme logo */
    $wp_customize->add_setting('hovercraft_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hovercraft_logo', array('label' => __('Logo', 'hovercraft'), 'section' => 'title_tagline', 'settings' => 'hovercraft_logo', 'description' => 'Upload a logo for the header with a maximum height of 75px.')));
    /* Theme options slider section */
    $wp_customize->add_section('hovercraft_slider_options', array('title' => __('Slider', 'hovercraft'), 'priority' => 900, 'description' => 'To customize the appearance of the fullscreen slider choose any of the options below.'));
    /* Theme options sidebar section */
    $wp_customize->add_section('hovercraft_sidebar_options', array('title' => __('Sidebar', 'hovercraft'), 'priority' => 150, 'description' => 'Select whether the sidebar should be displayed at the right or left side of the content.'));
    /* Slider animation. */
    $wp_customize->add_setting('hovercraft_slider_animation', array('default' => 'fade', 'sanitize_callback' => 'hovercraft_sanitize_slider_animation'));
    $wp_customize->add_control('hovercraft_slider_animation', array('label' => __('Animation Type', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('fade' => __('Fade', 'hovercraft'), 'slide' => __('Slide', 'hovercraft'))));
    /* Slider slideshow. */
    $wp_customize->add_setting('hovercraft_slider_slideshow', array('default' => 'true', 'sanitize_callback' => 'hovercraft_sanitize_slider_slideshow'));
    $wp_customize->add_control('hovercraft_slider_slideshow', array('label' => __('Advance Automatically', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 2, 'type' => 'radio', 'choices' => array('true' => __('True', 'hovercraft'), 'false' => __('False', 'hovercraft'))));
    /* Slider slideshow speed. */
    $wp_customize->add_setting('hovercraft_slider_delay', array('default' => 10, 'sanitize_callback' => 'hovercraft_sanitize_slider_delay'));
    $wp_customize->add_control('hovercraft_slider_delay', array('label' => __('Delay', 'hovercraft'), 'description' => __('Enter the number of seconds per slide.', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 3, 'type' => 'number'));
    /* Left sidebar or right sidebar */
    $wp_customize->add_setting('hovercraft_sidebar', array('default' => 'right-sidebar', 'sanitize_callback' => 'hovercraft_sanitize_sidebar'));
    $wp_customize->add_control('hovercraft_sidebar', array('label' => __('Sidebar: ', 'hovercraft'), 'section' => 'hovercraft_sidebar_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('right-sidebar' => __('Right sidebar', 'hovercraft'), 'left-sidebar' => __('Left sidebar', 'hovercraft'))));
    /* Remove the tagline control. */
    $wp_customize->remove_control('blogdescription');
}
Пример #26
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @since 3.0.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 * @return void
 */
function sosimplecustomize_register($wp_customize)
{
    if ($wp_customize->is_preview() && !is_admin()) {
        add_action('wp_footer', 'sosimplecustomize_preview', 21);
    }
    /**
     * Site Title & Description Section
     */
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /**
     * Create So Simple Panel
     */
    $wp_customize->add_panel('sosimplecustomizer', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('So Simple Customizer Options', 'so-simple-75'), 'description' => __('Theme Options for So Simple', 'so-simple-75')));
    /**
     * Logos Section
     */
    $wp_customize->add_section('logo_section', array('title' => __('Logos', 'so-simple-75'), 'priority' => 100, 'panel' => 'sosimplecustomizer'));
    $wp_customize->add_setting('sosimpleoptions[logo]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('section' => 'logo_section', 'label' => __('Custom Logo', 'so-simple-75'), 'settings' => 'sosimpleoptions[logo]', 'priority' => 100)));
    $wp_customize->add_setting('sosimpleoptions[favicon]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'favicon', array('section' => 'logo_section', 'label' => __('Custom Favicon', 'so-simple-75'), 'settings' => 'sosimpleoptions[favicon]', 'priority' => 150)));
    /**
     * Social Info
     */
    $wp_customize->add_section('social_section', array('title' => __('Social Media', 'so-simple-75'), 'priority' => 200, 'description' => __('Social Media', 'so-simple-75'), 'panel' => 'sosimplecustomizer'));
    $wp_customize->add_setting('sosimpleoptions[facebook]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'facebook', array('section' => 'social_section', 'label' => __('Facebook', 'so-simple-75'), 'settings' => 'sosimpleoptions[facebook]', 'priority' => 200)));
    $wp_customize->add_setting('sosimpleoptions[twitter]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'twitter', array('section' => 'social_section', 'label' => __('Twitter', 'so-simple-75'), 'settings' => 'sosimpleoptions[twitter]', 'priority' => 200)));
    $wp_customize->add_setting('sosimpleoptions[linkedin]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'linkedin', array('section' => 'social_section', 'label' => __('Linkedin', 'so-simple-75'), 'settings' => 'sosimpleoptions[linkedin]', 'priority' => 200)));
    $wp_customize->add_setting('sosimpleoptions[pinterest]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'pinterest', array('section' => 'social_section', 'label' => __('Pinterest', 'so-simple-75'), 'settings' => 'sosimpleoptions[pinterest]', 'priority' => 200)));
    $wp_customize->add_setting('sosimpleoptions[instagram]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'instagram', array('section' => 'social_section', 'label' => __('Instagram', 'so-simple-75'), 'settings' => 'sosimpleoptions[instagram]', 'priority' => 200)));
    /**
     * Copyright
     */
    $wp_customize->add_section('copyright_section', array('title' => __('Copyright', 'so-simple-75'), 'priority' => 200, 'description' => __('Display copyright', 'so-simple-75'), 'panel' => 'sosimplecustomizer'));
    $wp_customize->add_setting('sosimpleoptions[copyright]', array('default' => '', 'sanitize_callback' => 'sosimple_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'copyright', array('section' => 'copyright_section', 'label' => __('Copyright', 'so-simple-75'), 'settings' => 'sosimpleoptions[copyright]', 'priority' => 200, 'type' => 'checkbox')));
}
Пример #27
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function aperture_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';
    /* Remove existing not used sections. */
    //$wp_customize->remove_section('colors');
    /* Font color. */
    $wp_customize->add_setting('aperture_text_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'text_color', array('label' => __('Text Color', 'aperture'), 'section' => 'colors', 'priority' => 20, 'settings' => 'aperture_text_color')));
    /* Link color. */
    $wp_customize->add_setting('aperture_link_color', array('default' => '#ff8b27', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Color', 'aperture'), 'section' => 'colors', 'priority' => 30, 'settings' => 'aperture_link_color')));
    /* Content background color. */
    $wp_customize->add_setting('aperture_content_background_color', array('default' => '#000000', 'sanitize_callback' => 'aperture_hex2rgba'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_background_color', array('label' => __('Content Background Color', 'aperture'), 'section' => 'colors', 'priority' => 40, 'settings' => 'aperture_content_background_color')));
    /* Theme options panel */
    $wp_customize->add_panel('aperture_theme_options', array('priority' => 900, 'title' => __('Theme Options', 'aperture'), 'description' => 'This theme supports a number of options which you can set using this panel.'));
    /* Theme options slider section */
    $wp_customize->add_section('aperture_slider_options', array('title' => __('Slider Options', 'aperture'), 'priority' => 10, 'panel' => 'aperture_theme_options', 'description' => 'To customize the appearance of the fullscreen slider choose any of the options below.'));
    /* Theme options sidebar section */
    $wp_customize->add_section('aperture_sidebar_options', array('title' => __('Sidebar Options', 'aperture'), 'priority' => 20, 'panel' => 'aperture_theme_options', 'description' => 'Select whether the sidebar should be displayed at the right or left side of the content.'));
    /* Theme options footer section */
    $wp_customize->add_section('aperture_footer_options', array('title' => __('Footer Options', 'aperture'), 'priority' => 30, 'panel' => 'aperture_theme_options', 'description' => 'Add some custom text to the bottom right of the footer area.'));
    /* Slider animation. */
    $wp_customize->add_setting('aperture_slider_animation', array('default' => 'slide', 'sanitize_callback' => 'aperture_sanitize_slider_animation'));
    $wp_customize->add_control('aperture_slider_animation', array('label' => __('Animation: ', 'aperture'), 'section' => 'aperture_slider_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('slide' => __('Slide', 'aperture'), 'fade' => __('Fade', 'aperture'))));
    /* Slider direction. */
    $wp_customize->add_setting('aperture_slider_direction', array('default' => 'horizontal', 'sanitize_callback' => 'aperture_sanitize_slider_direction'));
    $wp_customize->add_control('aperture_slider_direction', array('label' => __('(Slide) Direction: ', 'aperture'), 'section' => 'aperture_slider_options', 'priority' => 2, 'type' => 'radio', 'choices' => array('horizontal' => __('Horizontal', 'aperture'), 'vertical' => __('Vertical', 'aperture'))));
    /* Slider slideshow. */
    $wp_customize->add_setting('aperture_slider_slideshow', array('default' => 'horizontal', 'sanitize_callback' => 'aperture_sanitize_slider_slideshow'));
    $wp_customize->add_control('aperture_slider_slideshow', array('label' => __('Slideshow: ', 'aperture'), 'section' => 'aperture_slider_options', 'priority' => 3, 'type' => 'radio', 'choices' => array('true' => __('True', 'aperture'), 'false' => __('False', 'aperture'))));
    /* Slider slideshow speed. */
    $wp_customize->add_setting('aperture_slider_speed', array('default' => 'horizontal', 'sanitize_callback' => 'aperture_sanitize_slider_speed'));
    $wp_customize->add_control('aperture_slider_speed', array('label' => __('Speed: ', 'aperture'), 'section' => 'aperture_slider_options', 'priority' => 4, 'type' => 'radio', 'choices' => array('20000' => __('Slowest', 'aperture'), '14000' => __('Slower', 'aperture'), '10000' => __('Slow', 'aperture'), '7000' => __('Default', 'aperture'), '5000' => __('Fast', 'aperture'), '3500' => __('Faster', 'aperture'), '2500' => __('Fastest', 'aperture'))));
    /* Left sidebar or right sidebar */
    $wp_customize->add_setting('aperture_sidebar', array('default' => 'right-sidebar', 'sanitize_callback' => 'aperture_sanitize_sidebar'));
    $wp_customize->add_control('aperture_sidebar', array('label' => __('Sidebar: ', 'aperture'), 'section' => 'aperture_sidebar_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('right-sidebar' => __('Right sidebar', 'aperture'), 'left-sidebar' => __('Left sidebar', 'aperture'))));
    /* Footer custom text */
    $wp_customize->add_setting('aperture_footer_text', array('default' => 'Some custom text here!', 'sanitize_callback' => 'aperture_sanitize_footer_text'));
    $wp_customize->add_control('aperture_footer_text', array('label' => 'Custom Footer Text: ', 'section' => 'aperture_footer_options', 'type' => 'text'));
}
Пример #28
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function corp_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->remove_section('colors');
    if (class_exists('WP_customize_Panel')) {
        $wp_customize->add_panel('panel_general', ['priority' => 30, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('General Settings', 'corp')]);
        $wp_customize->add_section('corp_general_section', ['title' => __('General', 'corp'), 'priority' => 30, 'panel' => 'panel_general']);
        $wp_customize->add_setting('corp_logo', ['sanitize_callback' => 'esc_url_raw']);
        $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'themeslug_logo', ['label' => __('Logo', 'corp'), 'section' => 'corp_general_section', 'settings' => 'corp_logo', 'priority' => 1]));
    }
    /**
     * ABOUT SECTION
     */
    $wp_customize->add_section('corp_about', ['title' => __('About section', 'corp'), 'priority' => 31]);
    /*show/hide*/
    $wp_customize->add_setting('corp_about', ['sanitize_callback' => 'corp_sanitize_text']);
    $wp_customize->add_control('corp_about', ['type' => 'checkbox', 'label' => __('Hide about row?', 'corp'), 'section' => 'corp_about', 'priority' => 1]);
}
Пример #29
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function elset_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->remove_section('colors');
    if (class_exists('WP_Customize_Panel')) {
        $wp_customize->add_panel('panel_general', ['priority' => 30, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('General Options', 'elset')]);
        $wp_customize->add_section('elset_general_section', ['title' => __('General', 'elset'), 'priority' => 30, 'panel' => 'panel_general']);
        $wp_customize->add_setting('elset_logo', ['sanitize_callback' => 'esc_url_raw']);
        $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'themeslug_logo', ['label' => __('Logo', 'elset'), 'section' => 'elset_general_section', 'settings' => 'elset_logo', 'priority' => 1]));
        $wp_customize->add_setting('elset_copyright', ['sanitize_callback' => 'elset_sanitize_text', 'default' => __('My web', 'elset')]);
        $wp_customize->add_control('elset_copyright', ['label' => __('Copyright', 'elset'), 'section' => 'elset_general_section', 'settings' => 'elset_copyright', 'priority' => 2]);
        $wp_customize->add_section('elset_apps_section', ['title' => __('Apps section', 'elset'), 'priority' => 35, 'description' => __('Main content is customizable in Customize -> Widgets')]);
        $wp_customize->add_section('elset_apps_show', ['sanitize_callback' => 'elset_sanitize_text']);
        $wp_customize->add_control('elset_apps_show', ['type' => 'checkbox', 'label' => __('Hide apps section'), 'section' => 'elset_apps_section', 'priority' => 1]);
        $wp_customize->add_section('elset_apps_title', ['sanitize_callback' => 'elset_sanitize_text', 'default' => __('Our apps section')]);
        $wp_customize->add_control('elset_apps_title', ['label' => __('Hide apps title', 'elset'), 'section' => 'elset_apps_section', 'settings' => 'elset_apps_title', 'priority' => 2]);
    }
}
Пример #30
0
/**
 * Add panel mobile and new fields to customizer
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 * @since SG Window 1.0.0
 */
function sgwindow_mobile_register($wp_customize)
{
    $defaults = sgwindow_get_defaults();
    $wp_customize->add_panel('mobile', array('priority' => 104, 'title' => __('Customize Mobile Version', 'sg-window'), 'description' => __('Settings for mobile users.', 'sg-window')));
    $section_priority = 10;
    $priority = 1;
    $wp_customize->add_section('width_mobile_switch', array('priority' => $section_priority++, 'title' => __('Columns', 'sg-window'), 'description' => __('Settings for small screens', 'sg-window'), 'panel' => 'mobile'));
    $wp_customize->add_setting('width_mobile_switch', array('type' => 'theme_mod', 'default' => $defaults['width_mobile_switch'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('width_mobile_switch', array('label' => __('Switch point', 'sg-window'), 'section' => 'width_mobile_switch', 'settings' => 'width_mobile_switch', 'type' => 'text', 'priority' => $priority++));
    $wp_customize->add_section('columns_direction', array('priority' => $section_priority++, 'title' => __('Order', 'sg-window'), 'description' => __('Order and visibility for columns on small screens', 'sg-window'), 'panel' => 'mobile'));
    //columns direction
    $wp_customize->add_setting('columns_direction', array('type' => 'theme_mod', 'default' => $defaults['columns_direction'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_content_column'));
    $wp_customize->add_control('columns_direction', array('label' => __('Content and column-1, column-2 position for small screens', 'sg-window'), 'section' => 'columns_direction', 'settings' => 'columns_direction', 'type' => 'select', 'priority' => $priority++, 'choices' => array('c_1_2' => __('Content-1-2', 'sg-window'), 'c_2_1' => __('Content-2-1', 'sg-window'), '1_c_2' => __('1-Content-2', 'sg-window'), '2_c_1' => __('2-Content-1', 'sg-window'), '1_2_c' => __('1-2-Content', 'sg-window'), '2_1_c' => __('2-1-Content', 'sg-window'))));
    //columns visibility
    $wp_customize->add_setting('is_mobile_column_1', array('default' => $defaults['is_mobile_column_1'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('is_mobile_column_1', array('label' => __('Check mark to display first column on small screens', 'sg-window'), 'section' => 'columns_direction', 'settings' => 'is_mobile_column_1', 'type' => 'checkbox', 'priority' => $priority++));
    //columns visibility
    $wp_customize->add_setting('is_mobile_column_2', array('default' => $defaults['is_mobile_column_2'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox'));
    $wp_customize->add_control('is_mobile_column_2', array('label' => __('Check mark to display second column on small screens', 'sg-window'), 'section' => 'columns_direction', 'settings' => 'is_mobile_column_2', 'type' => 'checkbox', 'priority' => $priority++));
}