本文整理汇总了PHP中WP_Customize_Manager类的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager类的具体用法?PHP WP_Customize_Manager怎么用?PHP WP_Customize_Manager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WP_Customize_Manager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_slug_register_customizer_panels
/**
* Theme Options Customizer Implementation.
*
* Implement the Theme Customizer for Theme Settings.
*
* @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
*
* @param WP_Customize_Manager $wp_customize Object that holds the customizer data.
*/
function theme_slug_register_customizer_panels($wp_customize)
{
/*
* Failsafe is safe
*/
if (!isset($wp_customize)) {
return;
}
/**
* Add Panel for General Settings.
*
* @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
* @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
*/
$wp_customize->add_panel('theme_slug_panel_general', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name General Settings', 'theme-slug'), 'description' => __('Configure general settings for the Theme Name Theme', 'theme-slug')));
/**
* Add Panel for Color and Layout Settings.
*
* @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
* @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
*/
$wp_customize->add_panel('theme_slug_panel_colorslayouts', array('priority' => 11, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name Colors and Layouts', 'theme-slug'), 'description' => __('Configure color and layout settings for the Theme Name Theme', 'theme-slug')));
/**
* Add Panel for Advanced Settings.
*
* @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
* @link $wp_customize->add_panel() https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_panel
*/
$wp_customize->add_panel('theme_slug_panel_advanced', array('priority' => 12, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Name Advanced Settings', 'theme-slug'), 'description' => __('Configure advanced settings for the Theme Name Theme', 'theme-slug')));
}
示例2: dbx_paper_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function dbx_paper_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('sitelogo')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
示例3: register
/**
* 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 Hyde 1.0
*/
public static function register($wp_customize)
{
//1. Register new settings to the WP database...
$wp_customize->add_setting('header_fontsize', array('default' => null, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
//2. 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_Control($wp_customize, 'hyde_header_fontsize', array('label' => __('Header Fontsize', 'hyde'), 'section' => 'title_tagline', 'settings' => 'header_fontsize', 'priority' => 10)));
}
示例4: riiskit_theme_customizer
/**
* 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'));
}
}
示例5: twentysixteen_child_customize_register
/**
* Adds postMessage support for site title and description for the Customizer.
*
* @since Twenty Sixteen 1.0
*
* @param WP_Customize_Manager $wp_customize The Customizer object.
*/
function twentysixteen_child_customize_register($wp_customize)
{
$color_scheme = twentysixteen_get_color_scheme();
// Add secondary text color setting and control.
$wp_customize->add_setting('header_text_color', array('default' => $color_scheme[5], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_text_color', array('label' => __('Header Text Color', 'twentysixteenchild'), 'section' => 'colors')));
}
示例6:
/**
* @param WP_Customize_Manager $wp_customize
* @internal
*/
function _action_customizer_live_fw_options($wp_customize)
{
if ($wp_customize->get_setting('fw_options[OPTION_ID]')) {
$wp_customize->get_setting('fw_options[OPTION_ID]')->transport = 'postMessage';
add_action('customize_preview_init', '_action_customizer_live_fw_options_preview');
}
}
示例7: bbird_under_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function bbird_under_customize_register($wp_customize)
{
$wp_customize->add_panel('footer_panel', array('priority' => 120, 'capability' => 'edit_theme_options', 'title' => __('Footer', 'bbird-under')));
$wp_customize->add_section('footer_widgets', array('title' => __('Widget options', 'bbird-under'), 'priority' => 12, 'panel' => 'footer_panel'));
$wp_customize->add_setting('footer_widgets', array('default' => 'no', 'sanitize_callback' => 'bbird_under_sanitize_select'));
$wp_customize->add_control('footer_widgets', array('type' => 'radio', 'label' => __('Choose the number of footer widgets', 'bbird-under'), 'section' => 'footer_widgets', 'choices' => array('no' => __('No widgets', 'bbird-under'), 'one' => __('One (Full width)', 'bbird-under'), 'two' => __('Two (One Half)', 'bbird-under'), 'three' => __('Three (One-third layout)', 'bbird-under'), 'four' => __('Four (One-fourth layout)', 'bbird-under'))));
}
示例8: twentyfourteen_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function twentyfourteen_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->add_setting('accent_color', array('default' => '#24890d', 'sanitize_callback' => 'twentyfourteen_generate_accent_colors'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'accent_color', array('label' => __('Accent Color', 'twentyfourteen'), 'section' => 'colors', 'settings' => 'accent_color')));
}
示例9: coursepress_customize_register
/**
* 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);
}
}
示例10: areavoices_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function areavoices_customize_register($wp_customize)
{
// var_dump( $wp_customize->settings() );
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
示例11: shapely_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function shapely_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
$wp_customize->get_setting('custom_logo')->transport = 'refresh';
// Abort if selective refresh is not available.
if (!isset($wp_customize->selective_refresh)) {
return;
}
$wp_customize->selective_refresh->add_partial('blogname', array('selector' => '.site-title', 'render_callback' => function () {
bloginfo('name');
}));
$wp_customize->selective_refresh->add_partial('footer_callout_text', array('selector' => '.footer-callout', 'render_callback' => function () {
shapely_footer_callout();
}));
$wp_customize->selective_refresh->add_partial('footer_callout_btntext', array('selector' => '.footer-callout', 'render_callback' => function () {
shapely_footer_callout();
}));
$wp_customize->selective_refresh->add_partial('footer_callout_link', array('selector' => '.footer-callout', 'render_callback' => function () {
shapely_footer_callout();
}));
$wp_customize->selective_refresh->add_partial('blog_name', array('selector' => '.header-callout', 'render_callback' => function () {
shapely_top_callout();
}));
$wp_customize->selective_refresh->add_partial('header_textcolor', array('selector' => '.header-callout', 'render_callback' => function () {
shapely_top_callout();
}));
}
示例12: tonal_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function tonal_customize_register($wp_customize)
{
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
$wp_customize->get_setting('background_image')->transport = 'postMessage';
}
示例13: create_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function create_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';
class CreateImportantLinks extends WP_Customize_Control
{
public $type = 'important-links';
public function render_content()
{
//Add Theme instruction, Support Forum, Changelog, Donate link, Review, Facebook, Twitter, Google+, Pinterest links
$important_links = array('theme_instructions' => array('link' => esc_url('http://catchthemes.com/theme-instructions/create/'), 'text' => __('Theme Instructions', 'create')), 'support' => array('link' => esc_url('http://catchthemes.com/support/'), 'text' => __('Support', 'create')), 'changelog' => array('link' => esc_url('http://catchthemes.com/changelogs/create-theme/'), 'text' => __('Changelog', 'create')), 'donate' => array('link' => esc_url('http://catchthemes.com/donate/'), 'text' => __('Donate Now', 'create')), 'review' => array('link' => esc_url('https://wordpress.org/support/view/theme-reviews/create'), 'text' => __('Review', 'create')), 'facebook' => array('link' => esc_url('https://www.facebook.com/catchthemes/'), 'text' => __('Facebook', 'create')), 'twitter' => array('link' => esc_url('https://twitter.com/catchthemes/'), 'text' => __('Twitter', 'create')), 'gplus' => array('link' => esc_url('https://plus.google.com/+Catchthemes/'), 'text' => __('Google+', 'create')), 'pinterest' => array('link' => esc_url('http://www.pinterest.com/catchthemes/'), 'text' => __('Pinterest', 'create')));
foreach ($important_links as $important_link) {
echo '<p><a target="_blank" href="' . $important_link['link'] . '" >' . $important_link['text'] . ' </a></p>';
}
}
}
//Important Links
$wp_customize->add_section('important_links', array('priority' => 999, 'title' => __('Important Links', 'create')));
/**
* Has dummy Sanitizaition function as it contains no value to be sanitized
*/
$wp_customize->add_setting('important_links', array('sanitize_callback' => 'create_sanitize_important_link'));
$wp_customize->add_control(new CreateImportantLinks($wp_customize, 'important_links', array('label' => __('Important Links', 'create'), 'section' => 'important_links', 'settings' => 'important_links', 'type' => 'important_links')));
//Important Links End
}
示例14: dimme_jour_customize_register
/**
* @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')));
}
示例15: narga_customize_register
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*
* @since NARGA v1.6
*/
function narga_customize_register($wp_customize)
{
$readmore = narga_options('post_readmore');
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}