Add a customize setting.
public add_setting ( WP_Customize_Setting | string $id, array $args = [] ) : WP_Customize_Setting | ||
$id | WP_Customize_Setting | string | Customize Setting object, or ID. |
$args | array | Setting arguments; passed to WP_Customize_Setting constructor. |
return | WP_Customize_Setting | The instance of the setting that was added. |
/** * 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'))); }
/** * 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')); }
/** * Add additional options and postMessage support to the customizer * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function govpress_customize_register($wp_customize) { $wp_customize->add_setting('govpress[header_taglinecolor]', array('default' => '#222222', 'type' => 'option')); if (get_theme_mod('header_textcolor') !== 'blank') { $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_tagline_color', array('label' => __('Header Tagline Color', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[header_taglinecolor]'))); } // $wp_customize->add_setting( 'govpress[primary_color]', array( // 'default' => '#0072BC', // 'type' => 'option' // ) ); // $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( // 'label' => __( 'Primary Color', 'govpress' ), // 'section' => 'colors', // 'settings' => 'govpress[primary_color]' // ) ) ); $wp_customize->add_setting('govpress[primary_link_color]', array('default' => '#428BCA', 'type' => 'option')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_link_color', array('label' => __('Primary Link Color', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[primary_link_color]'))); $wp_customize->add_setting('govpress[primary_link_hover]', array('default' => '#0072BC', 'type' => 'option')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_link_hover', array('label' => __('Primary Link Hover', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[primary_link_hover]'))); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; $wp_customize->get_setting('header_taglinecolor')->transport = 'postMessage'; // $wp_customize->get_setting( 'govpress[primary_color]' )->transport = 'postMessage'; $wp_customize->get_setting('govpress[primary_link_color]')->transport = 'postMessage'; $wp_customize->get_setting('govpress[primary_link_hover]')->transport = 'postMessage'; }
/** * 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 */ public static function register($wp_customize) { //2. Register new settings to the WP database... $wp_customize->add_setting('highlight_color', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); //3. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)... $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'mytheme_highlight_color', array('label' => __('Highlight Color', 'historias'), 'section' => 'colors', 'settings' => 'highlight_color', 'priority' => 10))); $wp_customize->add_setting('site_logo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/images/setoriais_logo.png')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'upload_site_logo', array('label' => __('Site Logo', 'historias'), 'section' => 'title_tagline', 'settings' => 'site_logo', 'priority' => 10))); $wp_customize->add_setting('site_tagline', array('default' => 'Eleição 2015', 'type' => 'option')); $wp_customize->add_control('site_tagline', array('type' => 'textarea', 'section' => 'title_tagline', 'label' => __('Tagline', 'historias'))); //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('header_textcolor')->transport = 'postMessage'; $wp_customize->get_setting('background_color')->transport = 'postMessage'; // $wp_customize->add_section('setorial_cnpc_logo_section', array( // 'title' => __('Logo', 'setorial_cnpc'), // 'description' => '', // 'priority' => 40, // )); // $wp_customize->add_setting('setorial_cnpc_logo]', array( // 'capability' => 'edit_theme_options', // 'type' => 'theme_mod', // 'default' => get_template_directory_uri() . '/images/setoriais_logo.png', // )); // $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'setorial_cnpc_logo', array( // 'label' => __('Imagem da logo', 'setorial_cnpc'), // 'section' => 'setorial_cnpc_logo_section', // 'settings' => 'setorial_cnpc_logo', // ))); }
/** * 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')); } }
/** * Register Customizer routine. * * @param \WP_Customize_Manager $wp_customize Manager. */ public function customizer(WP_Customize_Manager $wp_customize) { if (!isset($wp_customize->selective_refresh)) { return; } $wp_customize->add_panel('wpsc', array('title' => __('Store', 'wp-e-commerce'), 'description' => __('Presentational settings for your store.', 'wp-e-commerce'), 'priority' => 150)); foreach ($this->sections as $name => $label) { $wp_customize->add_section($name, array('title' => $label, 'panel' => 'wpsc')); } foreach ($this->settings as $name => $settings) { $wp_customize->add_setting($name, $settings['setting']); if (isset($settings['control']['class']) && 'WP_Customize_Control' === get_parent_class($settings['control']['class'])) { $class = $settings['control']['class']; foreach ($settings['control']['settings'] as $s) { $wp_customize->add_setting($s, $settings['setting']); } $wp_customize->add_control(new $class($wp_customize, $name, array('label' => $settings['control']['label'], 'section' => $settings['control']['section'], 'settings' => $settings['control']['settings']))); } else { $wp_customize->add_control($name, $settings['control']); } if (isset($settings['partial'])) { $wp_customize->selective_refresh->add_partial($name, $settings['partial']); } } }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function srizon_2016_customize_register($wp_customize) { // ---------------------------------------- // Add a new section called 'Test Controls' // ---------------------------------------- $wp_customize->add_section('srizon_test_section', array('title' => __('Test Controls'), 'priority' => '20')); // ----------------------------------------------- // Add a settings for Google Font Control (below) // ----------------------------------------------- $wp_customize->add_setting('srizon_body_font', array('default' => 'Open Sans')); // -------------------- // Google Font Control // -------------------- $wp_customize->add_control(new Srizon_Control_Google_Font($wp_customize, 'srizon_body_font', array('label' => __('Body Font'), 'section' => 'srizon_test_section', 'settings' => 'srizon_body_font'))); // ------------------------------------------------------------------------------------------ // Sample head section for this changes to take effect: // sample-output/google-font-header.php // ------------------------------------------------------------------------------------------ // ----------------------------------------- // Add a settings for Slider Control (below) // ----------------------------------------- $wp_customize->add_setting('srizon_body_font_size', array('default' => '16')); // -------------- // Slider Control // -------------- $wp_customize->add_control(new Srizon_Control_Slider($wp_customize, 'srizon_body_font_size', array('label' => __('Body Font Size'), 'description' => __('Base/Body font size in px'), 'section' => 'srizon_test_section', 'settings' => 'srizon_body_font_size'), array('step' => 1, 'min' => 10, 'max' => 30))); // ----------------------------------------- // Add a settings for Slider Control (below) // ----------------------------------------- $wp_customize->add_setting('srizon_h1_font_size', array('default' => '22')); // -------------- // Slider Control // -------------- $wp_customize->add_control(new Srizon_Control_Slider($wp_customize, 'srizon_h1_font_size', array('label' => __('H1 Font Size'), 'description' => __('H1 font size in px'), 'section' => 'srizon_test_section', 'settings' => 'srizon_h1_font_size'), array('step' => 1, 'min' => 10, 'max' => 40))); }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function aggression_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 Section Layout to the Customizer. */ $wp_customize->add_section('aggression-theme-options', array('title' => __('Theme Options', 'aggression'), 'capability' => 'edit_theme_options', 'description' => 'Edit Theme Options')); /** * Create Layout Setting. */ $wp_customize->add_setting('aggression_layout_settings', array('default' => 'full-width', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_layout_setting_sanitize', 'transport' => 'postMessage')); /** * Add Layout Controls. */ $wp_customize->add_control('aggression_layout_control', array('settings' => 'aggression_layout_settings', 'type' => 'radio', 'label' => __('Layout Options', 'aggression'), 'choices' => array('full-width' => __('Full Width (default)', 'aggression'), 'content-sidebar' => __('Content-Sidebar', 'aggression'), 'sidebar-content' => __('Sidebar-Content', 'aggression'), 'sidebar-content-sidebar' => __('Sidebar-Content-Sidebar', 'aggression'), 'content-sidebar-sidebar' => __('Content-Sidebar-Sidebar', 'aggression'), 'sidebar-sidebar-content' => __('Sidebar-Sidebar-Content', 'aggression')), 'section' => 'aggression-theme-options')); /** * Page Titles. */ $wp_customize->add_setting('aggression_page_titles_settings', array('default' => 'on', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_page_title_sanitize', 'transport' => 'postMessage')); /** * Page Titles Controls. */ $wp_customize->add_control('aggression_page_titles_control', array('settings' => 'aggression_page_titles_settings', 'type' => 'radio', 'label' => __('Page Titles', 'aggression'), 'choices' => array('on' => __('On (default)', 'aggression'), 'off' => __('Off', 'aggression')), 'section' => 'aggression-theme-options')); }
/** * 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')); } }
/** * @param WP_Customize_Manager $wp_customize Customizer object. */ function wplook_customize_register($wp_customize) { /*------------------------------------------------------------ Add Colors options ============================================================*/ /*------------------------------------------------------------ Add custom toolbar Color. ============================================================*/ $wp_customize->add_setting('wplook_toolbar_color', array('default' => '#232323', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_toolbar_color', array('label' => __('Toolbar Color', 'charity-life-wpl'), 'description' => __('Background color for Toolbar', 'charity-life-wpl'), 'section' => 'colors'))); /*------------------------------------------------------------ Add Footer Color ============================================================*/ $wp_customize->add_setting('wplook_footer_color', array('default' => '#232323', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_footer_color', array('label' => __('Footer background color', 'charity-life-wpl'), 'description' => __('Background color for Footer', 'charity-life-wpl'), 'section' => 'colors'))); /*------------------------------------------------------------ Add Footer Widget Color ============================================================*/ $wp_customize->add_setting('wplook_footer_widget_color', array('default' => '#262626', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_footer_widget_color', array('label' => __('Footer Widget background color', 'charity-life-wpl'), 'description' => __('Background color for Widget Footer', 'charity-life-wpl'), 'section' => 'colors'))); /*------------------------------------------------------------ Add Accent Color ============================================================*/ $wp_customize->add_setting('wplook_accent_color', array('default' => '#b54e2d', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_accent_color', array('label' => __('Accent Color', 'charity-life-wpl'), 'description' => __('Chose the Accent Color', 'charity-life-wpl'), 'section' => 'colors'))); /*------------------------------------------------------------ Add Accent Color 2 ============================================================*/ $wp_customize->add_setting('wplook_accent2_color', array('default' => '#468966', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_accent2_color', array('label' => __('Accent 2 Color', 'charity-life-wpl'), 'description' => __('Chose the Accent 2 Color', 'charity-life-wpl'), 'section' => 'colors'))); $wp_customize->remove_control('header_textcolor'); }
/** * Add multilingual controls. * The original controls will be hidden. * @param WP_Customize_Manager $wp_customize */ public static function action__customize_register(WP_Customize_Manager $wp_customize) { /** * Blog Name */ $wp_customize->add_setting('wpglobus_blogname', array('default' => WPGlobus_Core::text_filter(get_bloginfo('name'), WPGlobus::Config()->language))); $wp_customize->get_setting('wpglobus_blogname')->transport = 'postMessage'; $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'wpglobus_blogname', array('label' => __('Site Title'), 'type' => 'text', 'section' => 'title_tagline', 'settings' => 'wpglobus_blogname', 'values' => WPGlobus_Core::text_filter(get_bloginfo('name'), WPGlobus::Config()->language), 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-not-trigger-change')))); /** * Blog Description */ $wp_customize->add_setting('wpglobus_blogdescription', array('default' => WPGlobus_Core::text_filter(get_bloginfo('description'), WPGlobus::Config()->language))); $wp_customize->get_setting('wpglobus_blogdescription')->transport = 'postMessage'; $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'wpglobus_blogdescription', array('label' => __('Tagline'), 'type' => 'text', 'section' => 'title_tagline', 'settings' => 'wpglobus_blogdescription', 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-not-trigger-change')))); /** * Add elements from wpglobus-config.json */ if (empty(WPGlobus::Config()->WPGlobus_WP_Theme)) { return; } foreach (WPGlobus::Config()->WPGlobus_WP_Theme->elements as $key => $value) { /** * $value['type'] * @see https://codex.wordpress.org/Class_Reference/WP_Customize_Control for Input Types */ $wp_customize->add_setting($key, array('default' => '')); $wp_customize->get_setting($key)->transport = 'postMessage'; $wp_customize->add_control(new WP_Customize_Control($wp_customize, $key, array('label' => '{{title}}', 'description' => '{{description}}', 'type' => $value['type'], 'section' => $value['section'], 'settings' => $key, 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-control-' . $value['type'], 'data-type' => $value['type'], 'data-source' => '')))); } }
/** * 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 the_monday_customize_register($wp_customize) { $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; /*------------------------------------------------------------------------------------------------------------------------------*/ /** * Theme info */ $pro_themes_url = esc_url('https://accesspressthemes.com/wordpress-themes/'); $the_monday_more_themes = __('View more Free Themes ', 'the-monday') . ': <a href="' . esc_url(admin_url() . '/themes.php?page=the-monday-themes') . '">' . __(' here', 'the-monday') . '</a>'; $the_monday_pro_themes = __('View Pro Themes ', 'the-monday') . ': <a href="' . esc_url('https://accesspressthemes.com/wordpress-themes/') . '">' . __(' here', 'the-monday') . '</a>'; $the_monday_uesful_plugins = __('AccessPress Useful Plugins ', 'the-monday') . ': <a href="' . esc_url('https://accesspressthemes.com/plugins/') . '">' . __(' here', 'the-monday') . '</a>'; $the_monday_about_theme = __('The Monday is powerful features rich WordPress Free theme developed by AccessPress. ', 'the-monday'); $wp_customize->add_section('the_monday_themeinfo', array('title' => __('Theme info', 'the-monday'), 'priority' => 99)); // More Themes $wp_customize->add_setting('the_monday_more_themes', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_more_themes', array('section' => 'the_monday_themeinfo', 'label' => __('More Themes', 'the-monday'), 'description' => $the_monday_more_themes, 'priority' => 5))); //Pro Themes $wp_customize->add_setting('the_monday_pro_themes', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_pro_themes', array('section' => 'the_monday_themeinfo', 'label' => __('Pro Themes', 'the-monday'), 'description' => $the_monday_pro_themes, 'priority' => 5))); //Usesful Plugins $wp_customize->add_setting('the_monday_useful_plugins', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_useful_plugins', array('section' => 'the_monday_themeinfo', 'label' => __('Useful Plugins ', 'the-monday'), 'description' => $the_monday_uesful_plugins, 'priority' => 5))); //Usesful Plugins $wp_customize->add_setting('the_monday_about_theme', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_about_theme', array('section' => 'the_monday_themeinfo', 'label' => __('About The Monday ', 'the-monday'), 'description' => $the_monday_about_theme, 'priority' => 5))); }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function coursepress_customize_register($wp_customize) { $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; $colors = array(); $colors[] = array('slug' => 'body_text_color', 'default' => '#878786', 'label' => __('Body Text Color', 'cp')); $colors[] = array('slug' => 'content_text_color', 'default' => '#666666', 'label' => __('Content Text Color', 'cp')); $colors[] = array('slug' => 'content_header_color', 'default' => '#878786', 'label' => __('Content Header Color', 'cp')); $colors[] = array('slug' => 'content_link_color', 'default' => '#1cb8ea', 'label' => __('Content Links Color', 'cp')); $colors[] = array('slug' => 'content_link_hover_color', 'default' => '#1cb8ea', 'label' => __('Content Links Hover Color', 'cp')); $colors[] = array('slug' => 'main_navigation_link_color', 'default' => '#666', 'label' => __('Main Navigation Links Color', 'cp')); $colors[] = array('slug' => 'main_navigation_link_hover_color', 'default' => '#74d1d4', 'label' => __('Main Navigation Links Hover Color', 'cp')); $colors[] = array('slug' => 'footer_background_color', 'default' => '#f2f6f8', 'label' => __('Footer Background Color', 'cp')); $colors[] = array('slug' => 'footer_link_color', 'default' => '#83abb6', 'label' => __('Footer Links Color', 'cp')); $colors[] = array('slug' => 'footer_link_hover_color', 'default' => '#74d1d4', 'label' => __('Footer Links Hover Color', 'cp')); $colors[] = array('slug' => 'widget_title_color', 'default' => '#c0c21e', 'label' => __('Widgets Title Color', 'cp')); sort($colors); foreach ($colors as $color) { // SETTINGS $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'option', 'capability' => 'edit_theme_options')); // 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_setting('coursepress_logo', array('default' => get_template_directory_uri() . '/images/logo-default.png', 'type' => 'theme_mod', 'capability' => 'edit_theme_options')); $wp_customize->add_section('cp_logo_section', array('title' => __('Logo', 'cp'), 'priority' => 1)); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Upload a logo', 'cp'), 'section' => 'cp_logo_section', 'settings' => 'coursepress_logo'))); if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'coursepress_customize_preview', 21); } }
/** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function adaptable_customize_register($wp_customize) { /*class Color_Scheme_Custom_Control extends WP_Customize_Control { public function render_content() { ?> <label> <span class="customize-color-scheme-control"><?php echo esc_html( $this->label ); ?></span> <ul> <li><img src="<?php echo get_template_directory_uri() . '/images/eggplant.png' ?>" alt="Eggplant" /><input type="radio" name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>[style.css]" value="1" /></li> <li><img src="<?php echo get_template_directory_uri() . '/images/silverblue.png' ?>" alt="Silver Blue" /><input type="radio" name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>[bluewhitegray.css]" value="1" /></li> </ul> </label> <?php } }*/ $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; /* Adding a logo/image at the top of the sidebar */ $wp_customize->add_section('adaptable_logo_section', array('title' => __('Logo/Sidebar Image', 'adaptable'), 'priority' => 30, 'description' => 'Upload an image to appear at the top of the sidebar. Examples include a logo or blogger photo.')); $wp_customize->add_setting('adaptable_logo'); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'adaptable_logo', array('label' => __('Logo/Sidebar Image', 'adaptable'), 'section' => 'adaptable_logo_section', 'settings' => 'adaptable_logo'))); /* Add color scheme options */ $wp_customize->add_setting('adaptable_color_scheme'); $wp_customize->add_control('adaptable_color_scheme', array('label' => __('Color Scheme', 'adaptable'), 'section' => 'colors', 'settings' => 'adaptable_color_scheme', 'type' => 'radio', 'choices' => array('style.css' => 'Eggplant (Default)', 'bluewhitegray.css' => "Blue/White/Gray"))); }
/** * @param WP_Customize_Manager $wp_customize */ function dimme_jour_customize_register($wp_customize) { $wp_customize->add_setting('dimme_jour_options[logo]', array('capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Frontpage logo', 'dimme-jour'), 'section' => 'title_tagline', 'settings' => 'dimme_jour_options[logo]'))); $wp_customize->add_setting('dimme_jour_options[full_page_frontpage]', array('capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_html')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'full_page_frontpage', array('settings' => 'dimme_jour_options[full_page_frontpage]', 'label' => __('Show fullscreen frontpage', 'dimme-jour'), 'section' => 'title_tagline', 'type' => 'checkbox'))); }
/** * Add postMessage support for site title and description for the Customizer. * * @since Kute Theme 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function kt_customize_register($wp_customize) { $color_scheme = kt_get_color_scheme(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; // Add color scheme setting and control. $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'kt_sanitize_color_scheme', 'transport' => 'postMessage')); $wp_customize->add_control('color_scheme', array('label' => esc_attr__('Base Color Scheme', 'kutetheme'), 'section' => 'colors', 'type' => 'select', 'choices' => kt_get_color_scheme_choices(), 'priority' => 1)); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting('main_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_color', array('label' => esc_attr__('Theme Color', 'kutetheme'), 'description' => esc_attr__('Applied to the theme color.', 'kutetheme'), 'section' => 'colors'))); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control('header_textcolor'); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('box_background_color', array('default' => $color_scheme[2], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'box_background_color', array('label' => esc_attr__('Box and Sidebar Background Color', 'kutetheme'), 'description' => esc_attr__('Applied to the box and sidebar color.', 'kutetheme'), 'section' => 'colors'))); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('textcolor', array('default' => $color_scheme[3], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'textcolor', array('label' => esc_attr__('Text Color', 'kutetheme'), 'description' => esc_attr__('Applied to the text color', 'kutetheme'), 'section' => 'colors'))); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting('price_color', array('default' => $color_scheme[8], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'price_color', array('label' => esc_attr__('Price Color', 'kutetheme'), 'description' => esc_attr__('Applied to the price on wide screens.', 'kutetheme'), 'section' => 'colors'))); // Add an additional description to the header image section. $wp_customize->get_section('header_image')->description = esc_attr__('Applied to the header on small screens and the sidebar on wide screens.', 'kutetheme'); }
/** * 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)); } }
/** * Set up. */ function setUp() { parent::setUp(); $this->plugin = get_plugin_instance(); require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $GLOBALS['wp_customize'] = new \WP_Customize_Manager(); // WPCS: global override ok. $this->wp_customize = $GLOBALS['wp_customize']; $this->wp_customize->add_setting('foo', array('default' => 'foo_default')); $this->wp_customize->add_setting('bar', array('default' => 'bar_default')); $this->manager = new Customize_Snapshot_Manager($this->plugin); $this->manager->init(); $this->user_id = $this->factory()->user->create(array('role' => 'administrator')); remove_action('after_setup_theme', 'twentyfifteen_setup'); remove_action('after_setup_theme', 'twentysixteen_setup'); remove_all_actions('send_headers'); // Prevent X-hacker header in VIP Quickstart. // For why these hooks have to be removed, see <https://github.com/Automattic/nginx-http-concat/issues/5>. $this->css_concat_init_priority = has_action('init', 'css_concat_init'); if ($this->css_concat_init_priority) { remove_action('init', 'css_concat_init', $this->css_concat_init_priority); } $this->js_concat_init_priority = has_action('init', 'js_concat_init'); if ($this->js_concat_init_priority) { remove_action('init', 'js_concat_init', $this->js_concat_init_priority); } }
/** * 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 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')); }
/** * Register customizer options * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function sosimple_customize_register($wp_customize) { /* * Create theme seciton to hold our options. */ $wp_customize->add_section('theme', array('title' => __('Theme Options', 'sosimple'), 'priority' => 120)); /** * Admin */ $wp_customize->add_setting('disable_admin_teaks', array('sanitize_callback' => 'absint')); $wp_customize->add_control('disable_admin_teaks', array('label' => __('Disable So Simple admin tweaks', 'sosimple'), 'section' => 'theme', 'settings' => 'disable_admin_teaks', 'type' => 'checkbox', 'priority' => 10)); /** * Intro */ $wp_customize->add_setting('intro_page', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('intro_page', array('label' => __('Page for Intro', 'sosimple'), 'section' => 'theme', 'settings' => 'intro_page', 'type' => 'dropdown-pages', 'priority' => 15)); /** * Colors */ $wp_customize->add_setting('intro_background_color', array('default' => "#58cb8e", 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'intro_background_color', array('label' => 'Intro Background Color', 'section' => 'theme', 'settings' => 'intro_background_color', 'priority' => 20))); $wp_customize->get_setting('intro_background_color')->transport = 'postMessage'; $wp_customize->add_setting('intro_text_color', array('default' => 'text-dark', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('intro_text_color', array('label' => __('Intro Text Color', 'sosimple'), 'section' => 'theme', 'settings' => 'intro_text_color', 'type' => 'select', 'choices' => array('text-dark' => __('Dark Text', 'sosimple'), 'text-light' => __('Light Text', 'sosimple')), 'priority' => 25)); }
/** * 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 */ public static function register($wp_customize) { // Remove sections and native settings will not be used in theme // Remove setcions $wp_customize->remove_section('title_tagline'); $wp_customize->remove_section('background_image'); $wp_customize->remove_section('front_page'); // Remove setting $wp_customize->remove_setting('background_color'); // New settings to the top section (native section [header_image ]) // Logo $wp_customize->add_setting('logo', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'horizon_theme_sanitize_image'), 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'logo', array('label' => __('Site Logo top', 'horizon-theme'), 'section' => 'header_image', 'settings' => 'logo', 'priority' => 10))); // New settings for colors section (native section [colors]) // Primary Color $wp_customize->add_setting('primary_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary Color', 'horizon-theme'), 'section' => 'colors', 'settings' => 'primary_color', 'priority' => 10))); // Secondary Color $wp_customize->add_setting('secondary_color', array('default' => '#aac54b', 'sanitize_callback' => 'sanitize_hex_color', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary_color', array('label' => __('Secondary Color', 'horizon-theme'), 'section' => 'colors', 'settings' => 'secondary_color', 'priority' => 12))); // Dark Color $wp_customize->add_setting('dark_color', array('default' => 'rgba(41, 44, 46, 0.9)', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dark_color', array('label' => __('Dark Color', 'horizon-theme'), 'section' => 'colors', 'settings' => 'dark_color', 'type' => 'text'))); // Ligth Gray $wp_customize->add_setting('light_gray', array('default' => '#9f9f9f', 'sanitize_callback' => 'sanitize_hex_color', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'light_gray', array('label' => __('Ligth Gray', 'horizon-theme'), 'section' => 'colors', 'settings' => 'light_gray', 'priority' => 16))); }
/** * 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'))); }
/** * 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')); }
/** * Implement Theme Customizer additions and adjustments. * * @since Longform 1.0 * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function longform_customize_register($wp_customize) { // Add custom description to Colors and Background sections. $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'longform'); $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'longform'); // Add postMessage support for site title and description. $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'longform'); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'longform'); // Add the featured content section in case it's not already there. $wp_customize->add_section('featured_content', array('title' => __('Featured Content', 'longform'), 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'longform'), admin_url('/edit.php?tag=featured'), admin_url('/edit.php?show_sticky=1')), 'priority' => 130)); // Add the featured content layout setting and control. $wp_customize->add_setting('featured_content_layout', array('default' => 'slider', 'sanitize_callback' => 'longform_sanitize_layout')); $wp_customize->add_control('featured_content_layout', array('label' => __('Layout', 'longform'), 'section' => 'featured_content', 'type' => 'select', 'choices' => array('slider' => __('Slider', 'longform')))); // Add General setting panel and configure settings inside it $wp_customize->add_panel('longform_general_panel', array('priority' => 250, 'capability' => 'edit_theme_options', 'title' => __('General settings', 'longform'), 'description' => __('You can configure your general theme settings here', 'longform'))); // Website logo $wp_customize->add_section('longform_general_logo', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Website logo', 'longform'), 'description' => __('Please upload your logo, recommended logo size should be between 262x80', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_logo', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_logo', array('label' => __('Website logo', 'longform'), 'section' => 'longform_general_logo', 'settings' => 'longform_logo'))); // Copyright $wp_customize->add_section('longform_general_copyright', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Copyright', 'longform'), 'description' => __('Please provide short copyright text which will be shown in footer.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_copyright', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_copyright', array('label' => 'Copyright', 'section' => 'longform_general_copyright', 'type' => 'text')); // Scroll to top $wp_customize->add_section('longform_general_scrolltotop', array('priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Scroll to top', 'longform'), 'description' => __('Do you want to enable "Scroll to Top" button?', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_scrolltotop', array('sanitize_callback' => 'longform_sanitize_checkbox')); $wp_customize->add_control('longform_scrolltotop', array('label' => 'Scroll to top', 'section' => 'longform_general_scrolltotop', 'type' => 'checkbox')); // Favicon $wp_customize->add_section('longform_general_favicon', array('priority' => 40, 'capability' => 'edit_theme_options', 'title' => __('Favicon', 'longform'), 'description' => __('Do you have favicon? You can upload it here.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_favicon', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'longform_favicon', array('label' => __('Favicon', 'longform'), 'section' => 'longform_general_favicon', 'settings' => 'longform_favicon'))); // Page layout $wp_customize->add_section('longform_general_layout', array('priority' => 50, 'capability' => 'edit_theme_options', 'title' => __('Layout', 'longform'), 'description' => __('Choose a layout for your theme pages. Note that a widget has to be inside widget are, or the layout won\'t change.', 'longform'), 'panel' => 'longform_general_panel')); $wp_customize->add_setting('longform_layout', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_layout', array('type' => 'radio', 'label' => 'Layout', 'section' => 'longform_general_layout', 'choices' => array('full' => 'Full', 'right' => 'Right'))); // Add Stories grid setting panel and configure settings inside it $wp_customize->add_panel('longform_stories_panel', array('priority' => 260, 'capability' => 'edit_theme_options', 'title' => __('Stories grid', 'longform'), 'description' => __('You can configure your themes stories grid here.', 'longform'))); // Grid tag $wp_customize->add_section('longform_stories_tag', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Grid tag', 'longform'), 'description' => __('Please provide tag name of the posts which you want to show in "Stories grid" page.', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_tag', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_tag', array('label' => 'Grid tag', 'section' => 'longform_stories_tag', 'type' => 'text')); // Stories per page $wp_customize->add_section('longform_stories_perpage', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories per page', 'longform'), 'description' => __('How much stories should be showed per page?', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_per_page', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_per_page', array('label' => 'Stories per page', 'section' => 'longform_stories_perpage', 'type' => 'text')); // Stories order $wp_customize->add_section('longform_stories_order', array('priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Stories order', 'longform'), 'description' => __('The order for stories page', 'longform'), 'panel' => 'longform_stories_panel')); $wp_customize->add_setting('longform_stories_main_order', array('default' => 'ASC', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_stories_main_order', array('label' => 'Stories order', 'section' => 'longform_stories_order', 'type' => 'select', 'choices' => array('ASC' => __('Ascending', 'longform'), 'DESC' => __('Descending', 'longform')))); // Social links $wp_customize->add_section(new longform_Customized_Section($wp_customize, 'longform_social_links', array('priority' => 300, 'capability' => 'edit_theme_options'))); $wp_customize->add_setting('longform_fake_field', array('sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('longform_fake_field', array('label' => '', 'section' => 'longform_social_links', 'type' => 'text')); }
/** * Egyedi template beállítások * * @param WP_Customize_Manager $wp_customize */ function costumizeRegister($wp_customize) { $wp_customize->add_section('fansubpress_social_icon_section', array('title' => __('Közösségi oldalak', 'fansubpress-plugin'), 'priority' => 100, 'capability' => 'edit_theme_options', 'description' => __('Közösségi oldalak linkek megadása', 'fansubpress-plugin'))); $wp_customize->add_setting('fansubpress_indavideo', array('default' => '')); $wp_customize->add_setting('fansubpress_facebook', array('default' => '')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'fansubpress_social_icons_indavideo', array('label' => __('Indavideo', 'fansubpress-plugin'), 'section' => 'fansubpress_social_icon_section', 'settings' => 'fansubpress_indavideo'))); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'fansubpress_social_icons_facebook', array('label' => __('Facebook', 'fansubpress-plugin'), 'section' => 'fansubpress_social_icon_section', 'settings' => 'fansubpress_facebook'))); }
/** * Register Customizer settings. * * @since 1.0.0 * * @param WP_Customize_Manager $wp_customize Customizer manager object. */ public function customize_register($wp_customize) { $wp_customize->add_section('footer_credits', array('title' => __('Credits', 'footer-credits'), 'priority' => 1000)); $wp_customize->add_setting('footer_credits[text]', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'allowed_tags'), 'type' => 'option')); $wp_customize->add_control('footer_credits_text', array('label' => __('Credits', 'footer-credits'), 'section' => 'footer_credits', 'settings' => 'footer_credits[text]', 'type' => 'textarea')); $wp_customize->add_setting('footer_credits[placement]', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', 'type' => 'option')); $wp_customize->add_control('footer_credits_placement', array('choices' => array('' => '', 'before' => __('Before', 'footer-credits'), 'after' => __('After', 'footer-credits'), 'replace' => __('Replace', 'footer-credits'), 'remove' => __('Remove All', 'footer-credits')), 'label' => __('Placement', 'footer-credits'), 'section' => 'footer_credits', 'settings' => 'footer_credits[placement]', 'type' => 'select')); }
/** * Create the Fields/Settings for this sections * * @param WP_Customize_Section $section The WordPress section instance * @param WP_Customize_Manager $manager [description] * * @return void */ public function settings(WP_Customize_Section $section, WP_Customize_Manager $manager) { $customizer = Tribe__Events__Pro__Customizer__Main::instance(); $manager->add_setting($customizer->get_setting_name('calendar_header_color', $section), array('default' => $this->get_default('calendar_header_color'), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'sanitize_js_callback' => 'maybe_hash_hex_color')); $manager->add_control(new WP_Customize_Color_Control($manager, $customizer->get_setting_name('calendar_header_color', $section), array('label' => __('Calendar Header Color'), 'section' => $section->id))); $manager->add_setting($customizer->get_setting_name('calendar_datebar_color', $section), array('default' => $this->get_default('calendar_datebar_color'), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'sanitize_js_callback' => 'maybe_hash_hex_color')); $manager->add_control(new WP_Customize_Color_Control($manager, $customizer->get_setting_name('calendar_datebar_color', $section), array('label' => __('Calendar Date Bar Color'), 'section' => $section->id))); }
/** * Create the Fields/Settings for this sections * * @param WP_Customize_Section $section The WordPress section instance * @param WP_Customize_Manager $manager [description] * * @return void */ public function register_settings(WP_Customize_Section $section, WP_Customize_Manager $manager) { $customizer = Tribe__Events__Pro__Customizer__Main::instance(); $manager->add_setting($customizer->get_setting_name('post_title_color', $section), array('default' => $this->get_default('post_title_color'), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'sanitize_js_callback' => 'maybe_hash_hex_color')); $manager->add_control(new WP_Customize_Color_Control($manager, $customizer->get_setting_name('post_title_color', $section), array('label' => esc_html__('Post Title Color', 'tribe-events-calendar-pro'), 'section' => $section->id))); $manager->add_setting($customizer->get_setting_name('details_bg_color', $section), array('default' => $this->get_default('details_bg_color'), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'sanitize_js_callback' => 'maybe_hash_hex_color')); $manager->add_control(new WP_Customize_Color_Control($manager, $customizer->get_setting_name('details_bg_color', $section), array('label' => esc_html__('Details Background Color', 'tribe-events-calendar-pro'), 'section' => $section->id))); }