add_section() public method

Add a customize section.
Since: 3.4.0
Since: 4.5.0 Return added WP_Customize_Section instance.
public add_section ( WP_Customize_Section | string $id, array $args = [] ) : WP_Customize_Section
$id WP_Customize_Section | string Customize Section object, or Section ID.
$args array Section arguments.
return WP_Customize_Section The instance of the section that was added.
/**
 * Implement Theme Customizer additions and adjustments.
 * Static front page priority is 120, so we assign our section priorities higher
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function bigblank_customize_register($wp_customize)
{
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'bigblank');
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $defaults = bigblank_get_default_theme_options();
    // Contact Section
    $wp_customize->add_section('contact', array('title' => __('Contact Settings', 'bigblank'), 'priority' => 140));
    // phone text
    $wp_customize->add_setting('bigblank_theme_options[phone]', array('type' => 'option', 'default' => $defaults['phone']));
    $wp_customize->add_control('bigblank_theme_options[phone]', array('label' => __('Phone Number', 'bigblank'), 'section' => 'contact', 'settings' => 'bigblank_theme_options[phone]'));
    // address text
    $wp_customize->add_setting('bigblank_theme_options[address]', array('type' => 'option', 'default' => $defaults['address']));
    $wp_customize->add_control('bigblank_theme_options[address]', array('label' => __('Address', 'bigblank'), 'section' => 'contact', 'settings' => 'bigblank_theme_options[address]'));
    // social section
    $wp_customize->add_section('social', array('title' => __('Social Links', 'bigblank'), 'priority' => 150));
    // twitter
    $wp_customize->add_setting('bigblank_theme_options[twitter]', array('type' => 'option', 'default' => $defaults['twitter']));
    $wp_customize->add_control('bigblank_theme_options[twitter]', array('label' => __('Twitter', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[twitter]'));
    // facebook
    $wp_customize->add_setting('bigblank_theme_options[facebook]', array('type' => 'option', 'default' => $defaults['facebook']));
    $wp_customize->add_control('bigblank_theme_options[facebook]', array('label' => __('Facebook', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[facebook]'));
    // google+
    $wp_customize->add_setting('bigblank_theme_options[googleplus]', array('type' => 'option', 'default' => $defaults['googleplus']));
    $wp_customize->add_control('bigblank_theme_options[googleplus]', array('label' => __('Google+', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[googleplus]'));
    // instagram
    $wp_customize->add_setting('bigblank_theme_options[instagram]', array('type' => 'option', 'default' => $defaults['instagram']));
    $wp_customize->add_control('bigblank_theme_options[instagram]', array('label' => __('Instagram', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[instagram]'));
    // youtube
    $wp_customize->add_setting('bigblank_theme_options[youtube]', array('type' => 'option', 'default' => $defaults['youtube']));
    $wp_customize->add_control('bigblank_theme_options[youtube]', array('label' => __('Youtube', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[youtube]'));
    // pinterest
    $wp_customize->add_setting('bigblank_theme_options[pinterest]', array('type' => 'option', 'default' => $defaults['pinterest']));
    $wp_customize->add_control('bigblank_theme_options[pinterest]', array('label' => __('Pinterest', 'bigblank'), 'section' => 'social', 'settings' => 'bigblank_theme_options[pinterest]'));
    // Default Layout
    $wp_customize->add_section('bigblank_layout', array('title' => __('Layout', 'bigblank'), 'priority' => 130));
    $wp_customize->add_setting('bigblank_theme_options[theme_layout]', array('type' => 'option', 'default' => $defaults['theme_layout'], 'sanitize_callback' => 'sanitize_key'));
    $layouts = bigblank_layouts();
    $choices = array();
    foreach ($layouts as $layout) {
        $choices[$layout['value']] = $layout['label'];
    }
    $wp_customize->add_control('bigblank_theme_options[theme_layout]', array('section' => 'bigblank_layout', 'type' => 'radio', 'choices' => $choices));
    // Footer Section
    $wp_customize->add_section('footer', array('title' => __('Footer Settings', 'bigblank'), 'priority' => 160));
    // copyright text
    $wp_customize->add_setting('bigblank_theme_options[footer_copyright]', array('type' => 'option', 'default' => $defaults['footer_copyright']));
    $wp_customize->add_control('bigblank_theme_options[footer_copyright]', array('label' => __('Copyright Text', 'bigblank'), 'section' => 'footer', 'settings' => 'bigblank_theme_options[footer_copyright]'));
    // footer text
    $wp_customize->add_setting('bigblank_theme_options[footer_text]', array('type' => 'option', 'default' => $defaults['footer_text']));
    $wp_customize->add_control('bigblank_theme_options[footer_text]', array('label' => __('Footer Text', 'bigblank'), 'section' => 'footer', 'settings' => 'bigblank_theme_options[footer_text]'));
}
Example #2
1
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Honos 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function honos_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
    $wp_customize->get_section('background_image')->description = esc_html__('Background may only be visible on wide screens.', 'honos');
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Rename the label to "Site Title Color" because this only affects the site title in this theme.
    $wp_customize->get_control('header_textcolor')->label = esc_html__('Site Title Color', 'honos');
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = esc_html__('Display Site Title & Tagline', 'honos');
    $wp_customize->get_section('header_image')->title = esc_html__('Logo', 'honos');
    // Add Theme Options panel and configure settings inside it
    $wp_customize->add_panel('honos_theme_options_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => esc_html__('Theme Options', 'honos'), 'description' => esc_html__('You can configure your theme settings here', 'honos')));
    $wp_customize->add_section('honos_header_call_us', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Call us', 'honos'), 'description' => esc_html__('Here you\'re able to configure your header call us link.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_header_call_us_text', array('default' => esc_html__('Call us:', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_call_us_text', array('label' => esc_html__('Call us text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_call_us_link', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('honos_header_call_us_link', array('label' => esc_html__('Call us link', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_call_us_link_text', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_call_us_link_text', array('label' => esc_html__('Call us link text', 'honos'), 'section' => 'honos_header_call_us', 'type' => 'text'));
    // Consult
    $wp_customize->add_section('honos_header_consult', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Header Consult', 'honos'), 'description' => esc_html__('Consult text at the header.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_header_consult_text', array('default' => esc_html__('Request a free consultation', 'honos'), 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('honos_header_consult_text', array('label' => esc_html__('Consult text', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
    $wp_customize->add_setting('honos_header_consult_text_link', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('honos_header_consult_text_link', array('label' => esc_html__('Consult link', 'honos'), 'section' => 'honos_header_consult', 'type' => 'text'));
    // Footer columns
    $wp_customize->add_section('honos_footer_columns', array('priority' => 90, 'capability' => 'edit_theme_options', 'title' => esc_html__('Footer columns', 'honos'), 'description' => esc_html__('Footer column count.', 'honos'), 'panel' => 'honos_theme_options_panel'));
    $wp_customize->add_setting('honos_footer_column_count', array('default' => '4', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('honos_footer_column_count', array('label' => esc_html__('Footer columns', 'honos'), 'section' => 'honos_footer_columns', 'type' => 'select', 'choices' => array('1' => esc_html__('1 column', 'honos'), '2' => esc_html__('2 columns', 'honos'), '3' => esc_html__('3 columns', 'honos'), '4' => esc_html__('4 columns', 'honos'))));
}
Example #3
1
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Pure 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function pure_customize_register($wp_customize)
{
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /* 个人简介 */
    $wp_customize->add_section('pure_profile_options', array('title' => __('Profile', 'pure'), 'description' => __('Add profile here. This may be shown publicly', 'pure'), 'priority' => 25));
    // 是否显示
    $wp_customize->add_setting('pure_profile_show_on', array('default' => get_option('pure_profile_show_on', 'off'), 'sanitize_callback' => 'pure_sanitize_show_on'));
    $wp_customize->add_control('pure_profile_show_on', array('label' => __('Front page displays', 'pure'), 'section' => 'pure_profile_options', 'type' => 'radio', 'choices' => array('on' => __('Show on', 'pure'), 'off' => __('Show off', 'pure'))));
    // 邮箱
    $wp_customize->add_setting('pure_profile_email', array('default' => '', 'sanitize_callback' => 'pure_sanitize_email'));
    $wp_customize->add_control('pure_profile_email', array('label' => __('Email address', 'pure'), 'section' => 'pure_profile_options', 'type' => 'text'));
    // 昵称
    $wp_customize->add_setting('pure_profile_nickname', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_profile_nickname', array('label' => __('Nickname', 'pure'), 'section' => 'pure_profile_options', 'type' => 'text'));
    // 简介
    $wp_customize->add_setting('pure_profile_description', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_profile_description', array('label' => __('Description', 'pure'), 'section' => 'pure_profile_options', 'type' => 'textarea'));
    /* copyright */
    $wp_customize->add_section('pure_copyright_options', array('title' => __('Copyright', 'pure'), 'description' => __('Add copyright here. This may be shown publicly', 'pure'), 'priority' => 25));
    // 备案号
    $wp_customize->add_setting('pure_copyright_icp', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_copyright_icp', array('label' => __('ICP Licensing', 'pure'), 'section' => 'pure_copyright_options', 'type' => 'text'));
}
Example #4
1
 /**
  * This hooks into 'customize_register' (available as of WP 3.4) and allows
  * you to add new sections and controls to the Theme Customize screen.
  * 
  * Note: To enable instant preview, we have to actually write a bit of custom
  *  javascript. See live_preview() for more.
  *  
  * @see add_action('customize_register',$func)
  * @param \WP_Customize_Manager $wp_customize
  * @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
  * @since ProGo 0.4
  */
 public static function register($wp_customize)
 {
     // Page Layout Settings
     $wp_customize->add_section('pgb_options[layout]', array('title' => 'ProGo Layout and Options', 'priority' => 10, 'description' => ''));
     $wp_customize->add_setting('pgb_options[container_width]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_container_width')));
     $wp_customize->add_setting('pgb_options[bootstrap_theme]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_bootstrap_theme')));
     $wp_customize->add_control('pgb_options[container_width]', array('label' => __('Page Container Width', 'pgb'), 'section' => 'pgb_options[layout]', 'settings' => 'pgb_options[container_width]', 'type' => 'select', 'choices' => array('full' => 'Full Width (100%)', '1366' => '1366px', '1240' => '1240px', '1170' => '1170px', '1080' => '1080px', '960' => '960px')));
     $wp_customize->add_control('pgb_options[bootstrap_theme]', array('label' => __('Bootstrap Theme', 'pgb'), 'section' => 'pgb_options[layout]', 'settings' => 'pgb_options[bootstrap_theme]', 'type' => 'select', 'choices' => array('default' => 'Default Bootstrap', 'cerulean' => 'Cerulean', 'cosmo' => 'Cosmo', 'cyborg' => 'Cyborg', 'darkly' => 'Darkly', 'flatly' => 'Flatly', 'journal' => 'Journal', 'lumen' => 'Lumen', 'paper' => 'Paper', 'readable' => 'Readable', 'sandstone' => 'Sandstone', 'simplex' => 'Simplex', 'slate' => 'Slate', 'spacelab' => 'Spacelab', 'superhero' => 'Superhero', 'united' => 'United', 'yeti' => 'Yeti')));
     // Logo Settings
     $wp_customize->add_section('pgb_options[logo]', array('title' => 'Logos', 'priority' => 30, 'description' => ''));
     $wp_customize->add_setting('pgb_options[logo_mobile]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_setting('pgb_options[logo_tablet]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_setting('pgb_options[logo_desktop]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_mobile]', array('label' => __('Navbar Icon / Mobile Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_mobile]', 'description' => 'Add your logo to the Bootstrap <a href="http://getbootstrap.com/components/#navbar-brand-image" target="_blank">Brand Image</a> position. Displayed on screens under 768px wide.')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_tablet]', array('label' => __('Tablet Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_tablet]', 'description' => 'Tablet logo is displayed on screens 768px to 1024px wide.')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_desktop]', array('label' => __('Desktop Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_desktop]', 'description' => 'Desktop Logo is displayed on screen above 1024px wide.')));
     // Nav Settings
     $wp_customize->add_setting('pgb_options[menu_align]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_menu_align')));
     $wp_customize->add_setting('pgb_options[nav_position]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_nav_position')));
     $wp_customize->add_setting('pgb_options[nav_search]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_nav_search')));
     $wp_customize->add_control('pgb_options[menu_align]', array('label' => __('Main Menu Alignment', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[menu_align]', 'type' => 'radio', 'choices' => array('right' => 'Right', 'left' => 'Left')));
     $wp_customize->add_control('pgb_options[nav_position]', array('label' => __('Main Navbar Position', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[nav_position]', 'type' => 'radio', 'choices' => array('static' => 'Static', 'fixed' => 'Fixed')));
     $wp_customize->add_control('pgb_options[nav_search]', array('label' => __('Show Search in Main Navbar', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[nav_search]', 'type' => 'checkbox', 'value' => 1, 'description' => 'Adds search field to the far right of the navbar'));
     // Footer Settings
     $wp_customize->add_section('pgb_options[footer]', array('title' => 'Footer', 'priority' => 130, 'description' => ''));
     $wp_customize->add_setting('pgb_options[footer_show]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_footer_show')));
     $wp_customize->add_setting('pgb_options[footer_columns]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_footer_columns')));
     $wp_customize->add_control('pgb_options[footer_show]', array('label' => __('Show Footer Widgets', 'pgb'), 'section' => 'pgb_options[footer]', 'settings' => 'pgb_options[footer_show]', 'type' => 'checkbox', 'value' => '1'));
     $wp_customize->add_control('pgb_options[footer_columns]', array('label' => __('Number of Columns', 'pgb'), 'section' => 'pgb_options[footer]', 'settings' => 'pgb_options[footer_columns]', 'type' => 'select', 'choices' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4')));
 }
Example #5
1
/**
Configure custom theme options.
@param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function zorkish_customize_register($wp_customize)
{
    // Improve display of title, description, and header text color during preview
    // https://developer.wordpress.org/themes/advanced-topics/customizer-api/#using-postmessage-for-improved-setting-previewing
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Add a custom Customizer section
    $wp_customize->add_section('custom_favicon', array('title' => __('Favicon'), 'description' => __('Set up your site\'s favicon.'), 'panel' => '', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
    // Create a setting + control for the site favicons setup
    $wp_customize->add_setting('favicon_links', array('default' => ''));
    $wp_customize->add_control('favicon_links', array('type' => 'textarea', 'priority' => 10, 'section' => 'custom_favicon', 'label' => __('Favicon Links'), 'description' => __('Add your favicon links here.'), 'input_attrs' => array('class' => 'my-custom-class-for-js', 'style' => 'border: 1px solid #900', 'placeholder' => __('Add your favicon links here.'))));
    create_color_setting($wp_customize, 'header_color', 'Header Color', '#232323');
    create_color_setting($wp_customize, 'footer_color', 'Footer Color', '#232323');
    create_color_setting($wp_customize, 'header_byline_color', 'Byline Color', '#DDAE4F');
    // Remember whether Jetpack Site Logo is present
    $site_logo_active = function_exists('jetpack_the_site_logo');
    // Add a section for site logo customization. This is in additions
    // to whatever Jetpack might add (if installed).
    $wp_customize->add_section('zorkish_logo_section', array('title' => __($site_logo_active ? 'Inner Logo' : 'Site Logo', 'zorkish'), 'priority' => 30, 'description' => $site_logo_active ? 'Specify a logo to use on inner pages' : 'Upload a logo to replace the default site name and description in the header'));
    // If Jetpack isn't installed, display the custom logo uploader.
    // ALSO display it if we have a 'zorkish-logo' theme mod, to handle
    // the user adding a custom logo and later installing Jetpack.
    if (!$site_logo_active || get_theme_mod('zorkish-logo')) {
        $wp_customize->add_setting('zorkish_logo');
        $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'zorkish_logo', array('label' => __('Logo', 'zorkish'), 'section' => 'zorkish_logo_section', 'settings' => 'zorkish_logo')));
    }
    // Add a setting for the site's inner logo
    $wp_customize->add_setting('zorkish_inner_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'zorkish_inner_logo', array('label' => __('Inner Logo', 'zorkish'), 'section' => 'zorkish_logo_section', 'settings' => 'zorkish_inner_logo')));
}
Example #6
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function undiscovered_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Logo upload
    $wp_customize->add_section('undiscovered_logotype', array('title' => __('Logotype', 'undiscovered'), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name in the header'));
    $wp_customize->add_setting('undiscovered_options[logotype]', array('capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logotype', array('label' => __('Logo', 'undiscovered'), 'section' => 'undiscovered_logotype', 'settings' => 'undiscovered_options[logotype]')));
    // Fonts
    $wp_customize->add_section('undiscovered_fonts', array('title' => __('Fonts', 'undiscovered'), 'priority' => 30, 'description' => 'Set main website font'));
    $wp_customize->add_setting('undiscovered_options[font]', array('capability' => 'edit_theme_options', 'default' => 'Rokkit', 'type' => 'option'));
    $wp_customize->add_control('font', array('settings' => 'undiscovered_options[font]', 'label' => __('Fonts', 'undiscovered'), 'section' => 'undiscovered_fonts', 'type' => 'select', 'choices' => array('Rokkitt' => 'Rokkitt', 'Kameron' => 'Kameron', 'Abel' => 'Abel', 'Alice' => 'Alice', 'Andada' => 'Andada', 'Arbutus+Slab' => 'Arbutus Slab', 'Arvo' => 'Arvo', 'Brawler' => 'Brawler', 'Cambo' => 'Cambo', 'Cookie' => 'Cookie', 'Droid+Serif' => 'Droid Serif', 'Fenix' => 'Fenix', 'Judson' => 'Judson', 'Ledger' => 'Ledger', 'Libre+Baskerville' => 'Libre Baskerville', 'Lora' => 'Lora', 'Mako' => 'Mako', 'Marck+Script' => 'Marck Script', 'Maven+Pro' => 'Maven Pro', 'Neuton' => 'Neuton', 'Ovo' => 'Ovo', 'PT+Serif+Caption' => 'PT Serif Caption')));
    // Colors
    $wp_customize->add_section('undiscovered_colors', array('title' => __('Colors', 'undiscovered'), 'priority' => 40));
    // Primary
    $wp_customize->add_setting('undiscovered_options[primary_color]', array('default' => 'e83d52', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[primary_color]')));
    // Secondary
    $wp_customize->add_setting('undiscovered_options[secondary_color]', array('default' => 'be3243', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary_color', array('label' => __('Secondary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[secondary_color]')));
    // Social icons
    $wp_customize->add_section('undiscovered_social', array('title' => __('Social icons', 'undiscovered'), 'priority' => 30, 'description' => 'Leave blank if don\'t needed'));
    $networks = get_social_networks();
    foreach ($networks as $network) {
        $wp_customize->add_setting('undiscovered_options[social_' . strtolower($network) . ']', array('capability' => 'edit_theme_options', 'type' => 'option'));
        $wp_customize->add_control('undiscovered_options[social_' . strtolower($network) . ']', array('label' => $network, 'section' => 'undiscovered_social', 'type' => 'text'));
    }
}
Example #7
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @package		Riiskit
 * @subpackage	functions.php
 * @since		1.0.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function riiskit_theme_customizer($wp_customize)
{
    $wp_customize->remove_section('colors');
    $wp_customize->remove_section('background_image');
    $wp_customize->remove_section('static_front_page');
    // MOBILE
    // Mobile sidr.js menu on/off
    $wp_customize->add_section('developer', array('title' => __('Developer', 'riiskit'), 'priority' => 2, 'description' => __('Options for the developer.', 'riiskit')));
    // toggle/slideout selection
    $wp_customize->add_setting('developer_menu_type', array('default' => 'toggle-menu', 'type' => 'option', 'capability' => 'activate_plugins', 'sanitize_callback', 'riiskit_sanitize_menu_type'));
    $wp_customize->add_control('developer_menu_type', array('label' => __('Menutype', 'riiskit'), 'section' => 'developer', 'settings' => 'developer_menu_type', 'type' => 'select', 'choices' => array('toggle-menu' => 'Toggle', 'slideout-menu' => 'Slideout')));
    // SOCIAL
    $wp_customize->add_section('social', array('title' => __('Social', 'riiskit'), 'description' => __('Add links to your social profiles.', 'riiskit'), 'priority' => 135));
    $social_links = array();
    // Facebook
    $social_links[] = array('slug' => 'social_facebook_link', 'label' => 'Facebook');
    // Twitter
    $social_links[] = array('slug' => 'social_twitter_link', 'label' => 'Twitter');
    foreach ($social_links as $link) {
        // SETTINGS
        $wp_customize->add_setting($link['slug'], array('type' => 'option', 'sanitize_callback' => 'riiskit_sanitize_url'));
        // CONTROLS
        $wp_customize->add_control($link['slug'], array('label' => $link['label'], 'section' => 'social', 'settings' => $link['slug'], 'type' => 'text'));
    }
}
Example #8
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function everbox_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->add_section('everbox_general_section', array('title' => __('General', 'everbox')));
    // Primary Color
    $wp_customize->add_setting('everbox_primary_color', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'everbox_primary_color', array('label' => __('Primary Color', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_primary_color')));
    // Post excerpt length
    $wp_customize->add_setting('everbox_excerpt_length', array('default' => 60, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_integer'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_excerpt_length', array('label' => __('Post excerpt length', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_excerpt_length', 'type' => 'number')));
    // Cagetory link
    $wp_customize->add_setting('everbox_category_link', array('default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_category_link', array('label' => __('Show cagetory link', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_category_link', 'type' => 'checkbox')));
    // Infinite loading
    $wp_customize->add_setting('everbox_infinite', array('default' => 0, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_infinite', array('label' => __('Infinite Pagination with jetpack', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_infinite', 'type' => 'checkbox')));
    // Credit
    $wp_customize->add_setting('everbox_credit', array('default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'everbox_sanitize_bool'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'everbox_credit', array('label' => __('Footer Credit', 'everbox'), 'section' => 'everbox_general_section', 'settings' => 'everbox_credit', 'type' => 'checkbox')));
    $wp_customize->add_section('everbox_icons_section', array('title' => __('ICONS', 'everbox')));
    // LOGO
    $wp_customize->add_setting('everbox_logo', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_logo', array('label' => __('LOGO', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_logo')));
    // favicon
    $wp_customize->add_setting('everbox_favicon', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_favicon', array('label' => __('Favicon', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_favicon')));
    // iPhone App icon
    $wp_customize->add_setting('everbox_app', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'everbox_app', array('label' => __('iPhone Retina icon (sizes:120x120)', 'everbox'), 'section' => 'everbox_icons_section', 'settings' => 'everbox_app')));
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function simplicize_customize_register($wp_customize)
{
    // Set site name and description text to be previewed in real-time
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Set site title color to be previewed in real-time
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Site Title Section
    $wp_customize->add_section('title_tagline', array('title' => __('Site Title, Tagline & Logo', 'simplicize'), 'priority' => 1));
    //Logo Uploader
    $wp_customize->add_setting('simplicize_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'simplicize_logo', array('label' => __('Logo', 'simplicize'), 'section' => 'title_tagline', 'settings' => 'simplicize_logo', 'priority' => 1)));
    // Site Title Align
    $wp_customize->add_setting('title_align', array('default' => 'center', 'sanitize_callback' => 'simplicize_sanitize_logo_align'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'title_align', array('type' => 'radio', 'label' => __('Title & Logo Alignment', 'simplicize'), 'section' => 'title_tagline', 'choices' => array('left' => __('Left Align', 'simplicize'), 'center' => __('Center Align', 'simplicize'), 'right' => __('Right Align', 'simplicize')), 'priority' => 60)));
    //Layout
    $wp_customize->add_section('simplicize_layout_section', array('title' => __('Layout', 'simplicize'), 'priority' => 104));
    // Display Blog Author
    $wp_customize->add_setting('display_author_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_author_blog', array('label' => __('Show Blog Author Link?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_author_blog', 'type' => 'checkbox', 'priority' => 60)));
    // Display Blog Date
    $wp_customize->add_setting('display_date_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_date_blog', array('label' => __('Show Blog Date?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_date_blog', 'type' => 'checkbox', 'priority' => 60)));
    // Display Post Featured Image or Video
    $wp_customize->add_setting('display_feature_post', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_feature_post', array('label' => __('Show Post Featured Images?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_feature_post', 'type' => 'checkbox', 'priority' => 80)));
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function gravit_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';
    /* new section */
    $wp_customize->add_section('gravit_footer', array('title' => __('Footer', 'gravit'), 'priority' => 999));
    /* footer text */
    $wp_customize->add_setting('footer_text', array('default' => 'Gravit Theme powered by WordPress', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'footer_text', array('label' => __('Footer text', 'gravit'), 'section' => 'gravit_footer')));
    /* Colors extended */
    $colors = array();
    $colors[] = array('slug' => 'title_text_color', 'default' => '#4B4A47', 'label' => __('Site Title Text Color', 'gravit'));
    $colors[] = array('slug' => 'footer_text_color', 'default' => '#808080', 'label' => __('Footer Text Color', 'gravit'));
    $colors[] = array('slug' => 'footer_link_color', 'default' => '#c2c2c2', 'label' => __('Footer Link Color', 'gravit'));
    $colors[] = array('slug' => 'icon_color', 'default' => '#EF3636', 'label' => __('Icon Color', 'gravit'));
    $colors[] = array('slug' => 'about_page_color', 'default' => '#FFFFFF', 'label' => __('Aboute Me Page Background Color', 'gravit'));
    foreach ($colors as $color) {
        // SETTINGS
        $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color'));
        // CONTROLS
        $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => 'colors', 'settings' => $color['slug'])));
    }
    $wp_customize->add_section('global_options', array('title' => 'Global Options', 'priority' => 20));
    $wp_customize->add_setting('show_icons', array('default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'gravit_sanitize_checkbox'));
    $wp_customize->add_control('show_icons', array('section' => 'global_options', 'label' => 'Show Post Icons?', 'type' => 'checkbox'));
    $wp_customize->add_setting('remove_space', array('default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'gravit_sanitize_checkbox'));
    $wp_customize->add_control('remove_space', array('section' => 'global_options', 'label' => 'Remove Space beneath header?', 'type' => 'checkbox'));
}
Example #11
0
 /**
  * This hooks into 'customize_register' and allows you to add
  * new sections and controls to the Theme Customize screen.
  */
 public function register()
 {
     // Get filter data.
     $theme_panel = apply_filters('pt-sticky-menu/theme_panel', array('panel' => 'panel_autopt', 'priority' => 31));
     $settings_defaults = apply_filters('pt-sticky-menu/settings_default', array('sticky_selected' => false, 'fp_select' => 'none', 'fp_custom_text' => 'Featured Page', 'fp_cutsom_url' => '#', 'fp_new_window' => false, 'fp_icon' => 'fa-phone', 'fp_bg_color' => '#ffffff', 'logo_selected' => false, 'logo_img' => '', 'logo2x_img' => ''));
     // Section.
     $this->wp_customize->add_section('sticky_menu_section', array('title' => esc_html__('Sticky Menu', 'pt-sticky-menu'), 'description' => esc_html__('Settings for the sticky menu', 'pt-sticky-menu'), 'priority' => $theme_panel['priority'], 'panel' => $theme_panel['panel']));
     // Settings.
     $this->wp_customize->add_setting('sticky_menu_select', array('default' => $settings_defaults['sticky_selected']));
     $this->wp_customize->add_setting('sticky_menu_featured_page_select', array('default' => $settings_defaults['fp_select']));
     $this->wp_customize->add_setting('sticky_menu_featured_page_custom_text', array('default' => $settings_defaults['fp_custom_text']));
     $this->wp_customize->add_setting('sticky_menu_featured_page_custom_url', array('default' => $settings_defaults['fp_cutsom_url']));
     $this->wp_customize->add_setting('sticky_menu_featured_page_open_in_new_window', array('default' => $settings_defaults['fp_new_window']));
     $this->wp_customize->add_setting('sticky_menu_featured_page_icon', array('default' => $settings_defaults['fp_icon']));
     $this->wp_customize->add_setting('sticky_menu_bg_color', array('default' => $settings_defaults['fp_bg_color']));
     $this->wp_customize->add_setting('sticky_logo_selected', array('default' => $settings_defaults['logo_selected']));
     $this->wp_customize->add_setting('sticky_logo_img', array('default' => $settings_defaults['logo_img']));
     $this->wp_customize->add_setting('sticky_logo2x_img', array('default' => $settings_defaults['logo2x_img']));
     // Controls.
     $this->wp_customize->add_control('sticky_menu_select', array('type' => 'checkbox', 'priority' => 10, 'label' => esc_html__('Enable sticky menu', 'pt-sticky-menu'), 'section' => 'sticky_menu_section'));
     $this->wp_customize->add_control('sticky_menu_featured_page_select', array('type' => 'select', 'priority' => 20, 'label' => esc_html__('Featured page', 'pt-sticky-menu'), 'description' => esc_html__('To which page should the Call-to-action button link to?', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'choices' => Helpers::get_all_pages_id_title(), 'active_callback' => array($this, 'is_sticky_menu_selected')));
     $this->wp_customize->add_control('sticky_menu_featured_page_custom_text', array('priority' => 30, 'label' => esc_html__('Custom button text', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_featured_page_custom_url')));
     $this->wp_customize->add_control('sticky_menu_featured_page_custom_url', array('priority' => 40, 'label' => esc_html__('Custom URL', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_featured_page_custom_url')));
     $this->wp_customize->add_control('sticky_menu_featured_page_open_in_new_window', array('type' => 'checkbox', 'priority' => 50, 'label' => esc_html__('Open link in a new window/tab?', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_featured_page_selected')));
     $this->wp_customize->add_control('sticky_menu_featured_page_icon', array('priority' => 60, 'label' => esc_html__('Font Awesome icon', 'pt-sticky-menu'), 'description' => sprintf(esc_html__('Insert a %s icon. Example: fa-phone.', 'pt-sticky-menu'), '<a href="http://fontawesome.io/icons/" target="_blank">Font Awesome</a>'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_featured_page_selected')));
     $this->wp_customize->add_control(new \WP_Customize_Color_Control($this->wp_customize, 'sticky_menu_bg_color', array('priority' => 70, 'label' => esc_html__('Sticky menu background color', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_sticky_menu_selected'))));
     $this->wp_customize->add_control('sticky_logo_selected', array('type' => 'checkbox', 'priority' => 80, 'label' => esc_html__('Set custom logos for sticky menu?', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_sticky_menu_selected')));
     $this->wp_customize->add_control(new \WP_Customize_Image_Control($this->wp_customize, 'sticky_logo_img', array('priority' => 90, 'label' => esc_html__('Logo Image', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_custom_logo_selected'))));
     $this->wp_customize->add_control(new \WP_Customize_Image_Control($this->wp_customize, 'sticky_logo2x_img', array('priority' => 100, 'label' => esc_html__('Retina Logo Image', 'pt-sticky-menu'), 'description' => esc_html__('2x logo size, for screens with high DPI.', 'pt-sticky-menu'), 'section' => 'sticky_menu_section', 'active_callback' => array($this, 'is_custom_logo_selected'))));
 }
Example #12
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function graphy_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->add_setting('graphy_hide_blogdescription', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_hide_blogdescription', array('label' => __('Hide Tagline', 'graphy'), 'section' => 'title_tagline', 'settings' => 'graphy_hide_blogdescription', 'type' => 'checkbox'));
    $wp_customize->add_section('graphy_logo', array('title' => __('Logo', 'graphy'), 'priority' => 20));
    $wp_customize->add_setting('graphy_logo', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'graphy_logo', array('label' => __('Upload Logo', 'graphy'), 'section' => 'graphy_logo', 'settings' => 'graphy_logo')));
    $wp_customize->add_setting('graphy_top_margin', array('default' => '0', 'sanitize_callback' => 'graphy_sanitize_margin'));
    $wp_customize->add_control('graphy_top_margin', array('label' => __('Top Margin (px)', 'graphy'), 'section' => 'graphy_logo', 'settings' => 'graphy_top_margin', 'type' => 'text'));
    $wp_customize->add_setting('graphy_bottom_margin', array('default' => '0', 'sanitize_callback' => 'graphy_sanitize_margin'));
    $wp_customize->add_control('graphy_bottom_margin', array('label' => __('Bottom Margin (px)', 'graphy'), 'section' => 'graphy_logo', 'settings' => 'graphy_bottom_margin', 'type' => 'text'));
    $wp_customize->add_setting('graphy_replace_blogname', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_replace_blogname', array('label' => __('Replace Title', 'graphy'), 'section' => 'graphy_logo', 'settings' => 'graphy_replace_blogname', 'type' => 'checkbox'));
    $wp_customize->add_setting('graphy_add_border_radius', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_add_border_radius', array('label' => __('Add Border Radius', 'graphy'), 'section' => 'graphy_logo', 'settings' => 'graphy_add_border_radius', 'type' => 'checkbox'));
    $wp_customize->add_setting('graphy_link_color', array('default' => '#a62425', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'graphy_link_color', array('label' => __('Link Color', 'graphy'), 'section' => 'colors', 'settings' => 'graphy_link_color')));
    $wp_customize->add_setting('graphy_link_hover_color', array('default' => '#b85051', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'graphy_link_hover_color', array('label' => __('Link Hover Color', 'graphy'), 'section' => 'colors', 'settings' => 'graphy_link_hover_color')));
    $wp_customize->add_setting('graphy_hide_search', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_hide_search', array('label' => __('Hide Serach', 'graphy'), 'section' => 'nav', 'settings' => 'graphy_hide_search', 'type' => 'checkbox'));
    $wp_customize->add_section('graphy_article', array('title' => __('Article', 'graphy'), 'priority' => 100));
    $wp_customize->add_setting('graphy_content', array('default' => 'summary', 'sanitize_callback' => 'graphy_sanitize_content'));
    $wp_customize->add_control('graphy_content', array('label' => __('Display', 'graphy'), 'section' => 'graphy_article', 'settings' => 'graphy_content', 'type' => 'select', 'choices' => array('summary' => __('Summary', 'graphy'), 'content' => __('Full text', 'graphy'))));
    $wp_customize->add_setting('graphy_hide_author', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_hide_author', array('label' => __('Hide Author', 'graphy'), 'section' => 'graphy_article', 'settings' => 'graphy_hide_author', 'type' => 'checkbox'));
    $wp_customize->add_setting('graphy_hide_category', array('default' => '', 'sanitize_callback' => 'graphy_sanitize_checkbox'));
    $wp_customize->add_control('graphy_hide_category', array('label' => __('Hide Categories', 'graphy'), 'section' => 'graphy_article', 'settings' => 'graphy_hide_category', 'type' => 'checkbox'));
}
Example #13
0
/**
 * @param WP_Customize_Manager $wp_customize
 */
function wedge_customizer_register($wp_customize)
{
    $wp_customize->add_section('wedge_customizer_aside', array('title' => __('Aside', 'wedge'), 'priority' => 90));
    $wp_customize->add_section('wedge_customizer_basic', array('title' => __('Theme Options', 'wedge'), 'priority' => 150));
    // ### TITLE TAGLINE ###
    // Logo Image Upload
    $wp_customize->add_setting('wedge_customizer_logo', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'wedge_customizer_logo', array('label' => __('Logo Upload', 'wedge'), 'section' => 'title_tagline', 'settings' => 'wedge_customizer_logo')));
    // Logo Image Background Upload
    $wp_customize->add_setting('wedge_customizer_logo_bg', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'wedge_customizer_logo_bg', array('label' => __('Logo-Background Upload', 'wedge'), 'section' => 'title_tagline', 'settings' => 'wedge_customizer_logo_bg')));
    // Hide Title?
    $wp_customize->add_setting('wedge_customizer_hide_title', array('default' => false));
    $wp_customize->add_control('wedge_customizer_hide_title', array('label' => __('Hide the Title', 'wedge'), 'section' => 'title_tagline', 'type' => 'checkbox'));
    // Hide Description?
    $wp_customize->add_setting('wedge_customizer_hide_desc', array('default' => false));
    $wp_customize->add_control('wedge_customizer_hide_desc', array('label' => __('Hide the Description', 'wedge'), 'section' => 'title_tagline', 'type' => 'checkbox'));
    // ### COLORS ###
    // Color Scheme
    $wp_customize->add_setting('wedge_customizer_sidebar_color', array('default' => 'light', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wedge_sanitize_scheme_select'));
    $wp_customize->add_control('wedge_customizer_sidebar_color_select', array('settings' => 'wedge_customizer_sidebar_color', 'label' => __('Sidebar Color', 'wedge'), 'section' => 'colors', 'type' => 'select', 'choices' => array('dark' => __('Dark', 'wedge'), 'light' => __('Light', 'wedge'))));
    // ### ASIDE ###
    // Show Search-Bar
    $wp_customize->add_setting('wedge_customizer_sidebar_search', array('default' => false));
    $wp_customize->add_control('wedge_customizer_sidebar_search', array('label' => __('Show searchform in sidebar', 'wedge'), 'section' => 'wedge_customizer_aside', 'type' => 'checkbox'));
    // Featured Category Dropdown
    $wp_customize->add_setting('wedge_featured_cat', array('default' => '0', 'sanitize_callback' => 'wedge_sanitize_integer'));
    $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'wedge_featured_cat', array('label' => __('Featured Post Category', 'wedge'), 'section' => 'wedge_customizer_aside', 'settings' => 'wedge_featured_cat')));
}
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Meed Networks 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
*/
function twentyfifteen_customize_register($wp_customize)
{
    //$color_scheme = twentyfifteen_get_color_scheme();
    $wp_customize->get_setting('blogname')->transport = 'refresh';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    //add control for the header and tagline
    $wp_customize->add_section('Home-Header', array('title' => __('Text Description For The Home', 'meednetworks'), 'priority' => 15));
    $wp_customize->add_setting('home_header', array('default' => 'Nigeria Leading Network Infrastructure', 'transport' => 'refresh'));
    $wp_customize->add_control('home_header', array('label' => __('header_text', 'meednetworks'), 'section' => 'Home-Header', 'type' => 'text', 'priority' => 1));
    $wp_customize->add_setting('home_header_text', array('default' => 'We have a strong focus on using information technology to improve the operational efficiencies of institutions and organisations of different sizes. From integrated networks, fiber optics, cabling systems, Wireless/LAN, telecom infrastructure, biometrics, test and network security, our portfolio of ground-breaking solutions speak volume about our experience. See why you should work with us?', 'transport' => 'refresh'));
    $wp_customize->add_control('home_header_text', array('label' => __('Home Header Text', 'meednetworks'), 'section' => 'Home-Header', 'type' => 'textarea', 'priority' => 2));
    // Add control for the blog scheme setting and control.
    $wp_customize->add_section('Blog_summary', array('title' => __('Blog Summary', 'meednetworks'), 'priority' => 30));
    $wp_customize->add_setting('Blog_post_header', array('default' => 'Blog Post header', 'transport' => 'refresh'));
    $wp_customize->add_control('Blog_post_header', array('label' => __('Blog Post', 'meednetworks'), 'section' => 'Blog_summary', 'type' => 'text', 'priority' => 1));
    $wp_customize->add_setting('Blog_post_sub', array('default' => 'Latest Blog Posts', 'transport' => 'refresh'));
    $wp_customize->add_control('Blog_post_sub', array('label' => __('Blog Post', 'meednetworks'), 'section' => 'Blog_summary', 'type' => 'text', 'priority' => 2));
    $wp_customize->add_setting('Blog_post_summary', array('default' => 'We use the Meed Blog as a medium to articulate and share some of the knowledge and experiences we gain from the field. The objective is simply to improve the industry.', 'transport' => 'refresh'));
    $wp_customize->add_control('Blog_post_summary', array('label' => __('Blog Post Text', 'meednetworks'), 'section' => 'Blog_summary', 'type' => 'textarea', 'priority' => 3));
    //footer texts
    // Add control for the blog scheme setting and control.
    $wp_customize->add_section('Footer_text', array('title' => __('Footer Bar', 'meednetworks'), 'priority' => 30));
    $wp_customize->add_setting('copyright', array('default' => '© Copyright 2014 Meed Networks Limited. Website by Ultractiv. All Rights Reserved.', 'transport' => 'refresh'));
    $wp_customize->add_control('copyright', array('label' => __('copyright', 'meednetworks'), 'section' => 'Footer_text', 'type' => 'text', 'priority' => 1));
}
Example #15
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function maker_theme_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Add Social Media Section
    $wp_customize->add_section('social-media', array('title' => __('Social Media', 'maker'), 'priority' => 30, 'description' => __('Enter the URL to your account for each service for the icon to appear in the footer.', '')));
    // Add Twitter Setting
    $wp_customize->add_setting('twitter', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'twitter', array('label' => __('Twitter', 'maker'), 'section' => 'social-media', 'settings' => 'twitter')));
    // Add Facebook Setting
    $wp_customize->add_setting('facebook', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'facebook', array('label' => __('Facebook', 'maker'), 'section' => 'social-media', 'settings' => 'facebook')));
    // Add Instagram Setting
    $wp_customize->add_setting('instagram', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'Instagram', array('label' => __('Instagram', 'maker'), 'section' => 'social-media', 'settings' => 'instagram')));
    // Footer Contact Info
    $wp_customize->add_section('contact-info', array('title' => __('Contact Info (in footer)', 'maker'), 'priority' => 30, 'description' => __('', '')));
    // Add Twitter Setting
    $wp_customize->add_setting('email', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_email'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'email', array('label' => __('Email Address', 'maker'), 'section' => 'contact-info', 'settings' => 'email')));
    // Add Facebook Setting
    $wp_customize->add_setting('phone', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_html'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'phone', array('label' => __('Phone Number', 'maker'), 'section' => 'contact-info', 'settings' => 'phone')));
}
Example #16
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function agency_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_setting('header_bg_color', array('default' => '#000000', 'transport' => 'postMessage'));
    /*
     * Logo Uploader
     */
    $wp_customize->add_section('agency_logo_section', array('title' => __('Logo', 'agency'), 'priority' => 5, 'description' => 'Upload a logo to replace the default site name and description in the header'));
    $wp_customize->add_setting('agency_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'agency_logo', array('label' => __('Logo (70px by 70px)', 'agency'), 'section' => 'agency_logo_section', 'settings' => 'agency_logo')));
    /*
     * Accent Color Picker
     */
    $wp_customize->add_setting('accent_color', array('default' => '#ffc600'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => 'Accent Color', 'section' => 'colors', 'settings' => 'accent_color')));
    /*
     * Default Header Background
     */
    $wp_customize->add_section('agency_header_bg', array('title' => __('Default Header BG', 'agency'), 'priority' => 10, 'description' => 'Upload a background image to default to when no Featured Image is present.'));
    $wp_customize->add_setting('agency_bg');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'agency_bg', array('label' => __('Header Background Image', 'agency'), 'section' => 'agency_header_bg', 'settings' => 'agency_bg')));
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function hamburgercat_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    //All our sections, settings, and controls will be added here
    $wp_customize->add_setting('austeve_background_image');
    $wp_customize->add_setting('austeve_background_opacity');
    $wp_customize->add_setting('austeve_logo_image');
    $wp_customize->add_setting('austeve_num_sidebars');
    $wp_customize->add_setting('austeve_display_tagline');
    $wp_customize->add_section('hamburgercat_bg_section', array('title' => __('Background', 'hamburgercat'), 'priority' => 30, 'description' => 'Upload a background image'));
    $wp_customize->add_section('hamburgercat_images_section', array('title' => __('Images', 'hamburgercat'), 'priority' => 30, 'description' => 'Upload Images used in the theme here'));
    //Number of sidebars
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'austeve_num_sidebars', array('label' => __('Rows of content:', 'hamburger_cat'), 'section' => 'static_front_page', 'settings' => 'austeve_num_sidebars', 'type' => 'select', 'choices' => array('0' => __('None'), '1' => __('1'), '2' => __('2'), '3' => __('3'), '4' => __('4'), '5' => __('5'), '6' => __('6'), '7' => __('7'), '8' => __('8'), '9' => __('9')))));
    //Sidebar layouts
    for ($l = 1; $l <= get_theme_mod('austeve_num_sidebars', 0); $l++) {
        $wp_customize->add_setting('austeve_content_layout_' . $l, array('default' => '12', 'transport' => 'refresh'));
        $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'austeve_content_layout_' . $l, array('label' => __('Row ' . $l . ' layout', 'hamburger_cat'), 'section' => 'static_front_page', 'settings' => 'austeve_content_layout_' . $l, 'type' => 'text')));
    }
    //Background Image
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'austeve_background_image', array('label' => __('Image:', 'hamburgercat'), 'section' => 'hamburgercat_bg_section', 'settings' => 'austeve_background_image')));
    //Background opacity
    $wp_customize->add_control('austeve_background_opacity', array('label' => __('Opacity', 'hamburgercat'), 'section' => 'hamburgercat_bg_section', 'settings' => 'austeve_background_opacity', 'type' => 'text'));
    //Display tagline
    $wp_customize->add_control('austeve_display_tagline', array('label' => __('Display tagline', 'hamburgercat'), 'section' => 'title_tagline', 'settings' => 'austeve_display_tagline', 'type' => 'checkbox'));
    //Logo
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'austeve_logo_image', array('label' => __('Logo:', 'hamburgercat'), 'section' => 'title_tagline', 'settings' => 'austeve_logo_image')));
}
Example #18
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function adustus_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_section('adustus_primary', array('title' => __('Adustus Basic Settings'), 'description' => __('Here is where you will be able to make simple changes to your site.'), 'priority' => 160));
    $wp_customize->add_setting('adustus_excerpt', array('type' => 'theme_mod', 'default' => '55'));
    $wp_customize->add_control('adustus_excerpt', array('label' => __('Excerpt Length'), 'section' => 'adustus_primary', 'settings' => 'adustus_excerpt', 'type' => 'text'));
    $wp_customize->add_setting('adustus_bg_color', array('type' => 'theme_mod', 'default' => '#eeeeee'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'adustus_bg_color', array('label' => __('Background Color'), 'section' => 'adustus_primary', 'settings' => 'adustus_bg_color')));
    $wp_customize->add_section('adustus_content', array('title' => __('Adustus Content Settings'), 'description' => __('Here is where you will be able to change the categories of specific homepage sections'), 'priority' => 170));
    $categories = get_categories();
    $cats = array();
    $i = 0;
    foreach ($categories as $category) {
        if ($i == 0) {
            $default = $category->slug;
            $i++;
        }
        $cats[$category->slug] = $category->name;
    }
    $wp_customize->add_setting('adustus_featured_category1', array('type' => 'theme_mod', 'default' => $default));
    $wp_customize->add_control('adustus_featured_category1', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category1'));
    $wp_customize->add_setting('adustus_featured_category2', array('type' => 'theme_mod', 'default' => $default));
    $wp_customize->add_control('adustus_featured_category2', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category2'));
}
Example #19
0
/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @since Longform 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function longform_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'longform');
    $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'longform');
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Rename the label to "Site Title Color" because this only affects the site title in this theme.
    $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'longform');
    // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
    $wp_customize->get_control('display_header_text')->label = __('Display Site Title &amp; Tagline', 'longform');
    // Add the featured content section in case it's not already there.
    $wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'longform'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'longform'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130));
    // Add the featured content layout setting and control.
    $wp_customize->add_setting('featured_content_layout', array('default' => 'slider', 'sanitize_callback' => 'longform_sanitize_layout'));
    $wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'longform'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('slider' => __('Slider', 'longform'))));
    // Add General setting panel and configure settings inside it
    $wp_customize->add_panel('longform_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'longform'), 'description' => __('You can configure your general theme settings here', 'longform')));
    // Website logo
    $wp_customize->add_section('longform_general_logo', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Website logo', 'longform'), 'description' => __('Please upload your logo, recommended logo size should be between 262x80', 'longform'), 'panel' => 'longform_general_panel'));
    $wp_customize->add_setting('longform_logo', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_logo', array('label' => __('Website logo', 'longform'), 'section' => 'longform_general_logo', 'settings' => 'longform_logo')));
    // Copyright
    $wp_customize->add_section('longform_general_copyright', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Copyright', 'longform'), 'description' => __('Please provide short copyright text which will be shown in footer.', 'longform'), 'panel' => 'longform_general_panel'));
    $wp_customize->add_setting('longform_copyright', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_copyright', array('label' => 'Copyright', 'section' => 'longform_general_copyright', 'type' => 'text'));
    // Scroll to top
    $wp_customize->add_section('longform_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'longform'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'longform'), 'panel' => 'longform_general_panel'));
    $wp_customize->add_setting('longform_scrolltotop', array('sanitize_callback' => 'longform_sanitize_checkbox'));
    $wp_customize->add_control('longform_scrolltotop', array('label' => 'Scroll to top', 'section' => 'longform_general_scrolltotop', 'type' => 'checkbox'));
    // Favicon
    $wp_customize->add_section('longform_general_favicon', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Favicon', 'longform'), 'description' => __('Do you have favicon? You can upload it here.', 'longform'), 'panel' => 'longform_general_panel'));
    $wp_customize->add_setting('longform_favicon', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_favicon', array('label' => __('Favicon', 'longform'), 'section' => 'longform_general_favicon', 'settings' => 'longform_favicon')));
    // Page layout
    $wp_customize->add_section('longform_general_layout', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Layout', 'longform'), 'description' => __('Choose a layout for your theme pages. Note that a widget has to be inside widget are, or the layout won\'t change.', 'longform'), 'panel' => 'longform_general_panel'));
    $wp_customize->add_setting('longform_layout', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_layout', array('type' => 'radio', 'label' => 'Layout', 'section' => 'longform_general_layout', 'choices' => array('full' => 'Full', 'right' => 'Right')));
    // Add Stories grid setting panel and configure settings inside it
    $wp_customize->add_panel('longform_stories_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => __('Stories grid', 'longform'), 'description' => __('You can configure your themes stories grid here.', 'longform')));
    // Grid tag
    $wp_customize->add_section('longform_stories_tag', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Grid tag', 'longform'), 'description' => __('Please provide tag name of the posts which you want to show in "Stories grid" page.', 'longform'), 'panel' => 'longform_stories_panel'));
    $wp_customize->add_setting('longform_stories_tag', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_stories_tag', array('label' => 'Grid tag', 'section' => 'longform_stories_tag', 'type' => 'text'));
    // Stories per page
    $wp_customize->add_section('longform_stories_perpage', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories per page', 'longform'), 'description' => __('How much stories should be showed per page?', 'longform'), 'panel' => 'longform_stories_panel'));
    $wp_customize->add_setting('longform_stories_per_page', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_stories_per_page', array('label' => 'Stories per page', 'section' => 'longform_stories_perpage', 'type' => 'text'));
    // Stories order
    $wp_customize->add_section('longform_stories_order', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories order', 'longform'), 'description' => __('The order for stories page', 'longform'), 'panel' => 'longform_stories_panel'));
    $wp_customize->add_setting('longform_stories_main_order', array('default' => 'ASC', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_stories_main_order', array('label' => 'Stories order', 'section' => 'longform_stories_order', 'type' => 'select', 'choices' => array('ASC' => __('Ascending', 'longform'), 'DESC' => __('Descending', 'longform'))));
    // Social links
    $wp_customize->add_section(new longform_Customized_Section($wp_customize, 'longform_social_links', array('priority' => 300, 'capability' => 'edit_theme_options')));
    $wp_customize->add_setting('longform_fake_field', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('longform_fake_field', array('label' => '', 'section' => 'longform_social_links', 'type' => 'text'));
}
Example #20
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function _s_customize_register_child($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Site Identity
    $wp_customize->add_setting('logo');
    $wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'logo', array('label' => 'Site Logo', 'section' => 'title_tagline')));
    $wp_customize->add_setting('theme_color');
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'theme_color', array('label' => 'Theme Color', 'section' => 'title_tagline')));
    // Administration
    $wp_customize->add_section('_s_administration', array('title' => 'Administration', 'priority' => 35));
    $wp_customize->add_setting('google_tag_manager_account_id', array());
    $wp_customize->add_control('google_tag_manager_account_id', array('label' => 'Googl Tag Manager container ID', 'section' => '_s_administration', 'type' => 'text'));
    // Pages
    $wp_customize->add_section('_s_pages', array('title' => 'Pages', 'priority' => 35));
    $wp_customize->add_setting('page_contact', array());
    $wp_customize->add_control('page_contact', array('label' => 'Contact', 'section' => '_s_pages', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('page_about', array());
    $wp_customize->add_control('page_about', array('label' => 'About', 'section' => '_s_pages', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('page_faqs', array());
    $wp_customize->add_control('page_faqs', array('label' => 'FAQs', 'section' => '_s_pages', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('page_gallery', array());
    $wp_customize->add_control('page_gallery', array('label' => 'Gallery', 'section' => '_s_pages', 'type' => 'dropdown-pages'));
    // Contact Details
    $wp_customize->add_section('_s_contact', array('title' => 'Contact', 'priority' => 35));
    $wp_customize->add_setting('email', array());
    $wp_customize->add_control('email', array('label' => 'Email', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('phone', array());
    $wp_customize->add_control('phone', array('label' => 'Phone', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('mobile', array());
    $wp_customize->add_control('mobile', array('label' => 'Mobile', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('fax', array());
    $wp_customize->add_control('fax', array('label' => 'Fax', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('address', array());
    $wp_customize->add_control('address', array('label' => 'Address', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('map', array());
    $wp_customize->add_control('map', array('label' => 'Map', 'section' => '_s_contact', 'type' => 'text'));
    $wp_customize->add_setting('abn', array());
    $wp_customize->add_control('abn', array('label' => 'ABN', 'section' => '_s_contact', 'type' => 'text'));
    // Social Media Profiles
    $wp_customize->add_section('_s_social_media', array('title' => 'Social Media', 'priority' => 35));
    $wp_customize->add_setting('facebook', array());
    $wp_customize->add_control('facebook', array('label' => 'Facebook', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('googleplus', array());
    $wp_customize->add_control('googleplus', array('label' => 'Google Plus', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('twitter', array());
    $wp_customize->add_control('twitter', array('label' => 'Twitter', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('instagram', array());
    $wp_customize->add_control('instagram', array('label' => 'Instagram', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('pinterest', array());
    $wp_customize->add_control('pinterest', array('label' => 'Pinterest', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('youtube', array());
    $wp_customize->add_control('youtube', array('label' => 'YouTube', 'section' => '_s_social_media', 'type' => 'text'));
    $wp_customize->add_setting('linkedin', array());
    $wp_customize->add_control('linkedin', array('label' => 'LinkedIn', 'section' => '_s_social_media', 'type' => 'text'));
}
Example #21
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function stormbringer_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';
    // Favicon *******************
    $wp_customize->add_section('favicon', array('title' => __('Favicon', 'stormbringer'), 'priority' => 10));
    // Theme Color
    $wp_customize->add_setting('favicon_theme_color', array('default' => '#333', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'favicon_theme_color', array('label' => __('Theme Color', 'stormbringer'), 'section' => 'favicon', 'settings' => 'favicon_theme_color', 'priority' => 10)));
    // Mask Color
    $wp_customize->add_setting('favicon_mask_color', array('default' => '#333', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'favicon_mask_color', array('label' => __('Mask Color', 'stormbringer'), 'section' => 'favicon', 'settings' => 'favicon_mask_color', 'priority' => 10)));
    // Tile Color
    $wp_customize->add_setting('favicon_tile_color', array('default' => '#333', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'favicon_tile_color', array('label' => __('Tile Color', 'stormbringer'), 'section' => 'favicon', 'settings' => 'favicon_tile_color', 'priority' => 10)));
    // Favicons folder
    $wp_customize->add_setting('favicon_folder', ['default' => 'root']);
    $wp_customize->add_control('favicon_folder', array('label' => __('Folder', 'stormbringer'), 'section' => 'favicon', 'description' => __('Use http://realfavicongenerator.net to generate the favicons', 'stormbringer'), 'settings' => 'favicon_folder', 'type' => 'radio', 'choices' => array('root' => __('Relative to the root folder /', 'stormbringer'), 'theme' => __('Relative to the theme folder', 'stormbringer') . ': ' . get_stylesheet_directory_uri() . '/img/favicon/')));
    // Libraries ****************************
    $wp_customize->add_section('libraries', array('title' => __('External Libraries'), 'priority' => 10));
    // library
    if (current_theme_supports('libraries')) {
        $libraries = get_theme_support('libraries')[0];
        foreach ($libraries as $librarie_name => $librarie_key) {
            $wp_customize->add_setting('libraries_' . $librarie_name . '', array('default' => '1'));
            $wp_customize->add_control('libraries_' . $librarie_name . '', array('section' => 'libraries', 'default' => '1', 'label' => $librarie_name, 'type' => 'checkbox', 'std' => '1'));
        }
    }
    // Title Tagline ****************************
    $wp_customize->remove_setting('site_icon');
    // Lang
    $wp_customize->add_setting('lang', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('lang', array('section' => 'title_tagline', 'label' => __('Site Language'), 'type' => 'text'));
    // Misc ****************************
    $wp_customize->add_section('misc', array('title' => __('Misc.', 'stormbringer'), 'priority' => 10));
    // Excerpt Length
    $wp_customize->add_setting('excerpt_length', array('default' => '50', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('excerpt_length', array('section' => 'misc', 'label' => __('Excerpt Length', 'stormbringer'), 'type' => 'text'));
    // Google Fonts
    $wp_customize->add_setting('google_fonts', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('google_fonts', array('section' => 'misc', 'description' => 'Example: [\'Montserrat:400\',\'Dancing Script:400\']', 'label' => __('Google Fonts', 'stormbringer'), 'type' => 'text'));
    // Typekit
    $wp_customize->add_setting('typekit_id', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('typekit_id', array('section' => 'misc', 'label' => __('Typekit ID', 'stormbringer'), 'type' => 'text'));
    // Addthis
    $wp_customize->add_setting('addthis_id', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('addthis_id', array('section' => 'misc', 'label' => __('Addthis ID', 'stormbringer'), 'type' => 'text'));
    // category bottom description
    $wp_customize->add_setting('cuztom', array('default' => 0));
    $wp_customize->add_control('cuztom', array('section' => 'misc', 'label' => __('Load Cuztom library', 'stormbringer'), 'type' => 'checkbox'));
    // Bootstrap ****************************
    $wp_customize->add_section('bootstrap', array('title' => __('Bootstrap', 'stormbringer'), 'priority' => 0));
    // Preprocessor
    $wp_customize->add_setting('bootstrap_preprocessor', ['default' => 'scss']);
    $wp_customize->add_control('bootstrap_preprocessor', array('label' => __('Preprocessor', 'stormbringer'), 'section' => 'bootstrap', 'settings' => 'bootstrap_preprocessor', 'type' => 'radio', 'choices' => array('scss' => __('Scss', 'stormbringer'), 'less' => __('Less', 'stormbringer'))));
}
Example #22
0
/**
 * Add new controls and postMessage support for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function padhang_customize_register($wp_customize)
{
    // require cusom customizer controls
    require_once get_template_directory() . '/inc/customizer-controls.php';
    // Rename Background Image section to Background
    $wp_customize->get_section('background_image')->title = __('Background', 'padhang');
    // Move Background Color to Background section
    $wp_customize->get_control('background_color')->section = 'background_image';
    /**
     * General section
     */
    $wp_customize->add_section('padhang_general_section', array('title' => __('General', 'padhang'), 'priority' => 10));
    $wp_customize->add_setting('fonts_kit', array('default' => 'roboto', 'sanitize_callback' => 'padhang_sanitize_fontskit'));
    $wp_customize->add_control('fonts_kit', array('label' => __('Fonts Kit', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'fonts_kit', 'type' => 'select', 'choices' => array('roboto' => 'Roboto + Roboto Slab', 'opensans' => 'Open Sans + Bitter')));
    $wp_customize->add_setting('wrapper_width', array('default' => '96', 'sanitize_callback' => 'padhang_wrapper_width_sanitize'));
    $wp_customize->add_control('wrapper_width', array('label' => __('Wrapper width (%)', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'wrapper_width', 'type' => 'text'));
    $wp_customize->add_setting('footer_text', array('default' => '&copy; 2014 <a href="' . esc_url(home_url('/')) . '">' . bloginfo('name') . '</a>', 'sanitize_callback' => 'wp_kses_data'));
    $wp_customize->add_control(new Padhang_Customize_Textarea_Control($wp_customize, 'footer_text', array('label' => __('Footer text', 'padhang'), 'section' => 'padhang_general_section', 'settings' => 'footer_text')));
    /**
     * Title and Tagline section
     */
    $wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'options_heading', array('section' => 'title_tagline', 'type' => 'heading', 'label' => __('Title and Tagline Options', 'padhang'))));
    $wp_customize->add_setting('show_hide_title', array('default' => 1, 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('show_hide_title', array('label' => __('Show site title', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_title', 'type' => 'checkbox'));
    $wp_customize->add_setting('show_hide_tagline', array('default' => 1, 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('show_hide_tagline', array('label' => __('Show site tagline', 'padhang'), 'section' => 'title_tagline', 'settings' => 'show_hide_tagline', 'type' => 'checkbox'));
    /**
     * Logo section
     */
    $wp_customize->add_section('padhang_logo_section', array('title' => __('Logo', 'padhang'), 'priority' => 30));
    $wp_customize->add_setting('logo_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'logo_image', array('label' => __('Logo', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'logo_image', 'context' => 'padhang-logo-image')));
    $wp_customize->add_setting('favicon_image', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new Padhang_Customize_Image_Control($wp_customize, 'favicon_image', array('label' => __('Favicon', 'padhang'), 'section' => 'padhang_logo_section', 'settings' => 'favicon_image', 'context' => 'padhang-favicon-image')));
    /**
     * Colors section
     */
    $wp_customize->add_setting('site_title_color', array('default' => '#ffffff'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_title_color', array('label' => __('Title Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_title_color')));
    $wp_customize->add_setting('site_tagline_color', array('default' => '#ffffff'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_tagline_color', array('label' => __('Tagline Color', 'padhang'), 'section' => 'colors', 'settings' => 'site_tagline_color')));
    $wp_customize->add_setting('accent_color', array('default' => '#65b045'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => __('Accent Color', 'padhang'), 'section' => 'colors', 'settings' => 'accent_color')));
    $wp_customize->add_setting('overlay_color', array('default' => '#222222'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'overlay_color', array('label' => __('Overlay Color (%)', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_color')));
    $wp_customize->add_setting('overlay_transparency', array('default' => '70', 'sanitize_callback' => 'padhang_transparency_sanitize'));
    $wp_customize->add_control('overlay_transparency', array('label' => __('Overlay Transparency', 'padhang'), 'section' => 'colors', 'settings' => 'overlay_transparency', 'type' => 'text'));
    $wp_customize->add_control(new Padhang_Customize_Misc_Control($wp_customize, 'overlay_transparency_description', array('section' => 'colors', 'type' => 'text', 'description' => __('Set 0 to disable overlay.', 'padhang'))));
    /**
     * Background section
     */
    $wp_customize->add_setting('background_cover', array('default' => 0, 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('background_cover', array('label' => __('Make background image covering the page', 'padhang'), 'section' => 'background_image', 'settings' => 'background_cover', 'type' => 'checkbox'));
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
}
Example #23
0
/**
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function wplook_customize_register($wp_customize)
{
    /*------------------------------------------------------------
    		Add Colors options
    	============================================================*/
    /*------------------------------------------------------------
    		Add custom Link Color.
    	============================================================*/
    $wp_customize->add_setting('wplook_link_color', array('default' => '#117dbf', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_link_color', array('label' => __('Link Color', 'morningtime-lite'), 'description' => __('Default Link Color', 'morningtime-lite'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Hover Link Color
    	============================================================*/
    $wp_customize->add_setting('wplook_hover_link_color', array('default' => '#0078a0', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_hover_link_color', array('label' => __('Hover Link Color', 'morningtime-lite'), 'description' => __('Hover Link Color', 'morningtime-lite'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Accent Color
    	============================================================*/
    $wp_customize->add_setting('wplook_accent_color', array('default' => '#d95204', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_accent_color', array('label' => __('Accent Color', 'morningtime-lite'), 'description' => __('Chose the Accent Color', 'morningtime-lite'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Morning Time Theme Setings
    	============================================================*/
    $wp_customize->add_section('wplook_themes_settings', array('title' => __('Morning Time Settings', 'morningtime-lite'), 'description' => '', 'priority' => 30));
    /*------------------------------------------------------------
    		Upload a logo
    	============================================================*/
    $wp_customize->add_setting('wplook_logo', array('sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'wplook_logo', array('label' => __('Logo', 'morningtime-lite'), 'description' => __('Upload (190px x 50px) image size.', 'morningtime-lite'), 'section' => 'title_tagline', 'settings' => 'wplook_logo')));
    /*------------------------------------------------------------
    		Add Revolution Slider
    	============================================================*/
    $wp_customize->add_setting('wplook_rev_slider', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('wplook_rev_slider', array('label' => __('Revolution Slider', 'morningtime-lite'), 'description' => __('Revolution Slider Alias. If you have installed the revolution slider Plugin, add the Slider Alias here. From this example [rev_slider test] you need to add only the word test.', 'morningtime-lite'), 'section' => 'header_image'));
    /*------------------------------------------------------------
    		Add Copyright
    	============================================================*/
    $wp_customize->add_setting('wplook_copy', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('wplook_copy', array('label' => __('Copyright', 'morningtime-lite'), 'description' => __('Add Footer Copyright', 'morningtime-lite'), 'section' => 'wplook_themes_settings'));
    if (apply_filters('wplook_customizer_more', true)) {
        require_once dirname(__FILE__) . '/more.php';
    }
    /*------------------------------------------------------------
    		More Info
    	============================================================*/
    $wp_customize->add_section('wplook_more_settings', array('title' => __('More', 'morningtime-lite'), 'priority' => 999));
    /*------------------------------------------------------------
    		More info Details
    	============================================================*/
    if (apply_filters('wplook_customizer_more', true)) {
        $wp_customize->add_setting('wplook_more_settings', array('default' => null, 'sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control(new Wplook_Customize_Control($wp_customize, 'wplook_more_settings', array('label' => __('Looking for more options?', 'morningtime-lite'), 'description' => __('Use .png image type.', 'morningtime-lite'), 'section' => 'wplook_more_settings', 'settings' => 'wplook_more_settings')));
    }
}
Example #24
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function bbum_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    //$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage
    /////////////////////////////////////
    // Add Logo
    $wp_customize->add_setting('bblogo');
    // Add setting for logo uploader
    // Add control for logo uploader (actual uploader)
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bblogo', array('label' => __('Upload Logo', 'm1'), 'section' => 'title_tagline', 'settings' => 'bblogo')));
    /////////////////////////////////////
    // Add Contact Details Section
    $wp_customize->add_section('contact-details', array('title' => __('Contact Details', '_s'), 'priority' => 20, 'description' => __('Enter your contact details.', '_s')));
    // Add Email Setting
    $wp_customize->add_setting('bbemail', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbemail', array('label' => __('Email', '_s'), 'section' => 'contact-details', 'settings' => 'bbemail')));
    // Add Phone Setting
    $wp_customize->add_setting('bbphone', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbphone', array('label' => __('Phone', '_s'), 'section' => 'contact-details', 'settings' => 'bbphone')));
    // Add Mobile Setting
    $wp_customize->add_setting('bbmobile', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbmobile', array('label' => __('Mobile', '_s'), 'section' => 'contact-details', 'settings' => 'bbmobile')));
    // Add Address Setting
    $wp_customize->add_setting('bbaddress', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbaddress', array('label' => __('Address', '_s'), 'section' => 'contact-details', 'settings' => 'bbaddress')));
    // Add Conpany Reg Setting
    $wp_customize->add_setting('bbcompanyreg', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbcompanyreg', array('label' => __('Company Registration Number', '_s'), 'section' => 'contact-details', 'settings' => 'bbcompanyreg')));
    /////////////////////////////////////
    // Add Social Media Section
    $wp_customize->add_section('social-media', array('title' => __('Social Media', '_s'), 'priority' => 30, 'description' => __('Enter the URL to your account for each service for the icon to appear in the header.', '_s')));
    // Add Twitter Setting
    $wp_customize->add_setting('bbtwitter', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbtwitter', array('label' => __('Twitter', '_s'), 'section' => 'social-media', 'settings' => 'bbtwitter')));
    // Add Facebook Setting
    $wp_customize->add_setting('bbfacebook', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbfacebook', array('label' => __('Facebook', '_s'), 'section' => 'social-media', 'settings' => 'bbfacebook')));
    // Add YouTube Setting
    $wp_customize->add_setting('bbyoutube', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbyoutube', array('label' => __('YouTube', '_s'), 'section' => 'social-media', 'settings' => 'bbyoutube')));
    // Add LinkedIn Setting
    $wp_customize->add_setting('bblinkedin', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bblinkedin', array('label' => __('LinkedIn', '_s'), 'section' => 'social-media', 'settings' => 'bblinkedin')));
    // Add Google Plus Setting
    $wp_customize->add_setting('bbgoogleplus', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbgoogleplus', array('label' => __('Google Plus', '_s'), 'section' => 'social-media', 'settings' => 'bbgoogleplus')));
    // Add Instagram Setting
    $wp_customize->add_setting('bbinstagram', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbinstagram', array('label' => __('Instagram', '_s'), 'section' => 'social-media', 'settings' => 'bbinstagram')));
    // Add Pinterest Setting
    $wp_customize->add_setting('bbpinterest', array('default' => ''));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bbpinterest', array('label' => __('Pinterest', '_s'), 'section' => 'social-media', 'settings' => 'bbpinterest')));
}
Example #25
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function portfolio_theme_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';
    //Hero Section
    $wp_customize->add_section("hero", array("title" => __("Hero Section", "hero_section"), "priority" => 30));
    $wp_customize->add_setting('background_img', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'background_img', array('label' => __('Background Image', 'background_img_logo'), 'section' => 'hero', 'settings' => 'background_img')));
    $wp_customize->add_setting('hero_header', array('default' => 'Made For Designers', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'hero_header', array('label' => __('Hero Header Text', 'hero_header_label'), 'section' => 'hero', 'settings' => 'hero_header', 'type' => 'text')));
    $wp_customize->add_setting('hero_subtext', array('default' => 'Create your online portfolio in minutes with the professionally and lovingly designed REEN website template. Customize your site with versatile and easy to use features.', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'hero_subtext', array('label' => __('Hero Sub-text', 'hero_subtext_label'), 'section' => 'hero', 'settings' => 'hero_subtext', 'type' => 'text')));
    $wp_customize->add_setting('hero_button', array('default' => 'Get Started Now', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'hero_button', array('label' => __('Button Text', 'hero_button_label'), 'section' => 'hero', 'settings' => 'hero_button', 'type' => 'text')));
    $wp_customize->add_setting('logo', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'img-upload', array('label' => __('Logo', 'logo'), 'section' => 'title_tagline', 'settings' => 'logo')));
    $wp_customize->add_setting('email', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'email', array('label' => __('Email Address', 'email_label'), 'section' => 'title_tagline', 'settings' => 'email', 'type' => 'text')));
    $wp_customize->add_setting('phone', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'phone', array('label' => __('Phone Number', 'phone_label'), 'section' => 'title_tagline', 'settings' => 'phone', 'type' => 'text')));
    //Marketing Section
    $wp_customize->add_section("marketing", array("title" => __("Marketing Section", "marketing_section"), "priority" => 40));
    $wp_customize->add_setting('marketing_header', array('default' => 'Beautiful. Clean. Responsive.', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_header', array('label' => __('Marketing Header Text', 'marketing_header_label'), 'section' => 'marketing', 'settings' => 'marketing_header', 'type' => 'text')));
    $wp_customize->add_setting('marketing_text', array('default' => 'REEN is a high-quality solution for those who want a beautiful website in no time. Its fully responsive and will adapt itself to any mobile device. iPad, iPhone, Android, it doesnt matter. Your content will always looks its absolute best.', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_text', array('label' => __('Marketing Text', 'marketing_text_label'), 'section' => 'marketing', 'settings' => 'marketing_text', 'type' => 'text')));
    $wp_customize->add_setting('marketing_icon_one', array('default' => ''));
    $wp_customize->add_control('marketing_icon_one', array('type' => 'select', 'section' => 'marketing', 'choices' => array('glyphicon glyphicon-heart-empty' => 'Heart', 'glyphicon glyphicon-star-empty' => 'Star', 'glyphicon glyphicon-ok' => 'Check', 'glyphicon glyphicon-pencil' => 'Pencil', 'glyphicon glyphicon-thumbs-up' => 'Thumbs Up')));
    $wp_customize->add_setting('marketing_widget_one_header', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_one_header', array('label' => __('First Widget Header', 'marketing_one_header_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_one_header', 'type' => 'text')));
    $wp_customize->add_setting('marketing_widget_one_text', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_one_text', array('label' => __('First Widget text', 'marketing_one_text_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_one_text', 'type' => 'text')));
    $wp_customize->add_setting('marketing_icon_two', array('default' => ''));
    $wp_customize->add_control('marketing_icon_two', array('type' => 'select', 'section' => 'marketing', 'choices' => array('glyphicon glyphicon-heart-empty' => 'Heart', 'glyphicon glyphicon-star-empty' => 'Star', 'glyphicon glyphicon-ok' => 'Check', 'glyphicon glyphicon-pencil' => 'Pencil', 'glyphicon glyphicon-thumbs-up' => 'Thumbs Up')));
    $wp_customize->add_setting('marketing_widget_two_header', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_two_header', array('label' => __('Second Widget Header', 'marketing_two_header_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_two_header', 'type' => 'text')));
    $wp_customize->add_setting('marketing_widget_two_text', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_two_text', array('label' => __('Second Widget text', 'marketing_two_text_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_two_text', 'type' => 'text')));
    $wp_customize->add_setting('marketing_icon_three', array('default' => ''));
    $wp_customize->add_control('marketing_icon_three', array('type' => 'select', 'section' => 'marketing', 'choices' => array('glyphicon glyphicon-heart-empty' => 'Heart', 'glyphicon glyphicon-star-empty' => 'Star', 'glyphicon glyphicon-ok' => 'Check', 'glyphicon glyphicon-pencil' => 'Pencil', 'glyphicon glyphicon-thumbs-up' => 'Thumbs Up')));
    $wp_customize->add_setting('marketing_widget_three_header', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_three_header', array('label' => __('First Widget Header', 'marketing_three_header_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_three_header', 'type' => 'text')));
    $wp_customize->add_setting('marketing_widget_three_text', array('default' => '', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'marketing_widget_three_text', array('label' => __('First Widget text', 'marketing_three_text_label'), 'section' => 'marketing', 'settings' => 'marketing_widget_three_text', 'type' => 'text')));
    //Portfolio Section
    $wp_customize->add_section("portfolio", array("title" => __("Portfolio Section", "portfolio_section"), "priority" => 40));
    $wp_customize->add_setting('portfolio_header', array('default' => 'See our latest work', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'portfolio_header', array('label' => __('Portfolio Header Text', 'portfolio_header_label'), 'section' => 'portfolio', 'settings' => 'portfolio_header', 'type' => 'text')));
    $wp_customize->add_setting('portfolio_text', array('default' => 'Quo ne minim apeirian salutandi. Pro ponderum oportere electram te, ne quo affert pericula, nam melius saperet principes an. Eos no idque saepe scaevola, sit no magna falli euripidis. No inermis deserunt forensibus vel, vis nonumes suscipiantur ut. Harum accusamus no usu.', 'transport' => 'refresh'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'portfolio_text', array('label' => __('Portfolio Text', 'portfolio_text_label'), 'section' => 'portfolio', 'settings' => 'portfolio_text', 'type' => 'text')));
}
Example #26
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function mine_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_section('navbar', array('title' => __('Navbar brand text', 'mine')));
    $wp_customize->add_setting('navbar_brand', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'navbar_brand', array('label' => __('Text to be displayed on left side of main navigation', 'mine'), 'section' => 'navbar', 'settings' => 'navbar_brand', 'type' => 'text')));
    // Add footer copyright
    $wp_customize->add_section('copyright', array('title' => __('Footer Copyright', 'mine')));
    $wp_customize->add_setting('bpl_copyright', array('default' => '', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bpl_copyright', array('label' => __('Add Name', 'mine'), 'section' => 'copyright', 'settings' => 'bpl_copyright', 'type' => 'text')));
}
 /**
  * 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');
 }
Example #28
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function landing_customize_register($wp_customize)
{
    $wp_customize->remove_section('static_front_page');
    $wp_customize->remove_section('title_tagline');
    $wp_customize->remove_control('blogdescription');
    $wp_customize->remove_control('display_header_text');
    $wp_customize->add_section('title_tagline', array('title' => __('Site Title & User Info', 'landing'), 'priority' => 20));
    $wp_customize->add_setting('username', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'EL Maxo', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('userskills', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'web developer', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('telephone', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '+9999999999', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('address', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'Lorem Ipsum - это текст-"рыба", часто используемый в печати и вэб-дизайне.', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('email', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '*****@*****.**', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_email($str);
    }));
    $wp_customize->add_setting('birthday', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '1988-04-03', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_email($str);
    }));
    $wp_customize->add_setting('site', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'webdesign-master.ru', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('prof_description', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'Проффестональное создание сайтов: разработка дизайна, верстка, посадка на CMS WOrdPress', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return implode("\n", array_map('sanitize_text_field', explode("\n", $str)));
    }));
    $wp_customize->add_control('username', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your name', 'landing')));
    $wp_customize->add_control('userskills', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your speciality', 'landing')));
    $wp_customize->add_control('telephone', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your telephone', 'landing')));
    $wp_customize->add_control('address', array('type' => 'textarea', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your address', 'landing')));
    $wp_customize->add_control('email', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your email', 'landing')));
    $wp_customize->add_control('birthday', array('type' => 'date', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your birth day', 'landing')));
    $wp_customize->add_control('site', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your site (without http://)', 'landing')));
    $wp_customize->add_control('prof_description', array('type' => 'textarea', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your Professional Description', 'landing')));
    $wp_customize->add_section('logo', array('title' => __('Logo', 'landing'), 'description' => __('Select Your Logo', 'landing'), 'priority' => 90));
    $wp_customize->add_setting('logo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/img/logo.svg', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Featured Logo', 'landing'), 'section' => 'logo', 'settings' => 'logo', 'mime_type' => 'image')));
    $wp_customize->add_section('photo', array('title' => __('Photo', 'landing'), 'description' => __('Select Your Photo', 'landing'), 'priority' => 90));
    $wp_customize->add_setting('photo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/img/photo.jpg', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'photo', array('label' => __('Your Photo', 'landing'), 'section' => 'photo', 'settings' => 'photo')));
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function twentyseventeen_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->selective_refresh->add_partial('blogname', array('selector' => '.site-title a', 'render_callback' => 'twentyseventeen_customize_partial_blogname'));
    $wp_customize->selective_refresh->add_partial('blogdescription', array('selector' => '.site-description', 'render_callback' => 'twentyseventeen_customize_partial_blogdescription'));
    /**
     * Custom colors.
     */
    $wp_customize->add_setting('colorscheme', array('default' => 'light', 'transport' => 'postMessage', 'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme'));
    $wp_customize->add_setting('colorscheme_hue', array('default' => 250, 'transport' => 'postMessage', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('colorscheme', array('type' => 'radio', 'label' => __('Color Scheme', 'twentyseventeen'), 'choices' => array('light' => __('Light', 'twentyseventeen'), 'dark' => __('Dark', 'twentyseventeen'), 'custom' => __('Custom', 'twentyseventeen')), 'section' => 'colors', 'priority' => 5));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'colorscheme_hue', array('mode' => 'hue', 'section' => 'colors', 'priority' => 6)));
    /**
     * Theme options.
     */
    $wp_customize->add_section('theme_options', array('title' => __('Theme Options', 'twentyseventeen'), 'priority' => 130));
    $wp_customize->add_setting('page_layout', array('default' => 'two-column', 'sanitize_callback' => 'twentyseventeen_sanitize_page_layout', 'transport' => 'postMessage'));
    $wp_customize->add_control('page_layout', array('label' => __('Page Layout', 'twentyseventeen'), 'section' => 'theme_options', 'type' => 'radio', 'description' => __('When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen'), 'choices' => array('one-column' => __('One Column', 'twentyseventeen'), 'two-column' => __('Two Column', 'twentyseventeen')), 'active_callback' => 'twentyseventeen_is_view_with_layout_option'));
    /**
     * Filter number of front page sections in Twenty Seventeen.
     *
     * @since Twenty Seventeen 1.0
     *
     * @param $num_sections integer
     */
    $num_sections = apply_filters('twentyseventeen_front_page_sections', 4);
    // Create a setting and control for each of the sections available in the theme.
    for ($i = 1; $i < 1 + $num_sections; $i++) {
        $wp_customize->add_setting('panel_' . $i, array('default' => false, 'sanitize_callback' => 'absint', 'transport' => 'postMessage'));
        $wp_customize->add_control('panel_' . $i, array('label' => sprintf(__('Front Page Section %d Content', 'twentyseventeen'), $i), 'description' => 1 !== $i ? '' : __('Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen'), 'section' => 'theme_options', 'type' => 'dropdown-pages', 'allow_addition' => true, 'active_callback' => 'twentyseventeen_is_static_front_page'));
        $wp_customize->selective_refresh->add_partial('panel_' . $i, array('selector' => '#panel' . $i, 'render_callback' => 'twentyseventeen_front_page_section', 'container_inclusive' => true));
    }
}
Example #30
-1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function enlighten_customize_register($wp_customize)
{
    $wp_customize->add_section('enlighten_logo_section', array('title' => __('Logo', 'enlighten'), 'priority' => 5, 'description' => 'Upload your own logo to replace the default logo.  Remove the default logo if you would like to use the default site name and description.'));
    $wp_customize->add_setting('enlighten_logo', array('default' => get_template_directory_uri() . '/images/logo.png', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'enlighten_logo', array('label' => __('Upload a logo (size 185 x 183 pixels)', 'enlighten'), 'section' => 'enlighten_logo_section', 'settings' => 'enlighten_logo')));
    // Add Social Media Section
    $wp_customize->add_section('social-media', array('title' => __('Social Media', 'enlighten'), 'priority' => 30, 'description' => __('Enter the URL to your account for each service for the icon to appear in the header.', 'enlighten')));
    // Add Twitter Setting
    $wp_customize->add_setting('twitter', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'twitter', array('label' => __('Twitter', 'enlighten'), 'section' => 'social-media', 'settings' => 'twitter', 'sanitize_callback' => 'esc_url_raw')));
    // Add Facebook Setting
    $wp_customize->add_setting('facebook', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'facebook', array('label' => __('Facebook', 'enlighten'), 'section' => 'social-media', 'settings' => 'facebook', 'sanitize_callback' => 'esc_url_raw')));
    // Add Vimeo Setting
    $wp_customize->add_setting('vimeo', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'vimeo', array('label' => __('Vimeo', 'enlighten'), 'section' => 'social-media', 'settings' => 'vimeo', 'sanitize_callback' => 'esc_url_raw')));
    // Add Youtube Setting
    $wp_customize->add_setting('youtube', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'youtube', array('label' => __('YouTube', 'enlighten'), 'section' => 'social-media', 'settings' => 'youtube')));
    // Add Pinterest Setting
    $wp_customize->add_setting('pinterest', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'pinterest', array('label' => __('Pinterest', 'enlighten'), 'section' => 'social-media', 'settings' => 'pinterest', 'sanitize_callback' => 'esc_url_raw')));
    // Add Instagram Setting
    $wp_customize->add_setting('instagram', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'instagram', array('label' => __('Instagram', 'enlighten'), 'section' => 'social-media', 'settings' => 'instagram')));
    // Add RSS Setting
    $wp_customize->add_setting('rss', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'rss', array('label' => __('RSS', 'enlighten'), 'section' => 'social-media', 'settings' => 'rss')));
    // Add the featured content section in case it's not already there.
    $wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'enlighten'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts.', 'enlighten'), esc_url(add_query_arg('tag', _x('featured', 'featured content default tag slug', 'enlighten'), admin_url('edit.php')))), 'priority' => 130));
}