当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Customize_Manager::register_section_type方法代码示例

本文整理汇总了PHP中WP_Customize_Manager::register_section_type方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::register_section_type方法的具体用法?PHP WP_Customize_Manager::register_section_type怎么用?PHP WP_Customize_Manager::register_section_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Manager的用法示例。


在下文中一共展示了WP_Customize_Manager::register_section_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: screenr_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function screenr_customize_register($wp_customize)
{
    // Load custom controls.
    require get_template_directory() . '/inc/customizer-controls.php';
    // Load custom sections.
    require get_template_directory() . '/inc/customizer-sections.php';
    // Register custom section types.
    $wp_customize->register_section_type('Screenr_Customize_Section_Plus');
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $pages = get_pages();
    $option_pages = array();
    $option_pages[0] = esc_html__('Select page', 'screenr');
    foreach ($pages as $p) {
        $option_pages[$p->ID] = $p->post_title;
    }
    $wp_customize->add_setting('screenr_hide_sitetitle', array('sanitize_callback' => 'screenr_sanitize_checkbox', 'default' => 0, 'transport' => 'postMessage'));
    $wp_customize->add_control('screenr_hide_sitetitle', array('label' => esc_html__('Hide site title', 'screenr'), 'section' => 'title_tagline', 'type' => 'checkbox'));
    $wp_customize->add_setting('screenr_hide_tagline', array('sanitize_callback' => 'screenr_sanitize_checkbox', 'default' => '', 'transport' => 'postMessage'));
    $wp_customize->add_control('screenr_hide_tagline', array('label' => esc_html__('Hide site tagline', 'screenr'), 'section' => 'title_tagline', 'type' => 'checkbox'));
    /*------------------------------------------------------------------------*/
    /*  Upgrade Panel
        /*------------------------------------------------------------------------*/
    $wp_customize->add_section(new Screenr_Customize_Section_Plus($wp_customize, 'screenr_plus_upgrade', array('title' => esc_html__('Screenr Plus', 'screenr'), 'priority' => 180, 'plus_text' => esc_html__('Upgrade Now', 'screenr'), 'plus_url' => screenr_get_plus_url())));
    /*------------------------------------------------------------------------*/
    /*  Site Options
        /*------------------------------------------------------------------------*/
    $wp_customize->add_panel('screenr_options', array('priority' => 170, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__('Theme Options', 'screenr'), 'description' => ''));
    /* Theme styling
       ----------------------------------------------------------------------*/
    $wp_customize->add_section('theme_styling', array('priority' => 3, 'title' => esc_html__('Styling', 'screenr'), 'description' => '', 'panel' => 'screenr_options'));
    // Move background setting to theme styling
    if ($wp_customize->get_control('background_color')) {
        $wp_customize->get_control('background_color')->section = 'theme_styling';
    }
    $wp_customize->add_setting('primary_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => esc_html__('Primary color', 'screenr'), 'section' => 'theme_styling', 'description' => '', 'priority' => 3)));
    /* Typography
       ----------------------------------------------------------------------*/
    $wp_customize->add_section(new Screenr_Customize_Section_Plus($wp_customize, 'screenr_typography_plus', array('title' => esc_html__('Typography', 'screenr'), 'priority' => 4, 'panel' => 'screenr_options', 'plus_text' => esc_html__('Go Plus', 'screenr'), 'plus_url' => screenr_get_plus_url())));
    /* Header
       ----------------------------------------------------------------------*/
    $wp_customize->add_section('header_settings', array('priority' => 7, 'title' => esc_html__('Header', 'screenr'), 'description' => '', 'panel' => 'screenr_options'));
    // Header Transparent
    $wp_customize->add_setting('header_layout', array('sanitize_callback' => 'sanitize_text_field', 'default' => 'default'));
    $wp_customize->add_control('header_layout', array('type' => 'select', 'label' => esc_html__('Header style', 'screenr'), 'section' => 'header_settings', 'choices' => array('default' => esc_html__('Default', 'screenr'), 'fixed' => esc_html__('Fixed', 'screenr'), 'transparent' => esc_html__('Fixed & Transparent', 'screenr'))));
    /* Default menu style
     * --------------------------------------*/
    // Header BG Color
    $wp_customize->add_setting('header_bg_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_bg_color', array('label' => esc_html__('Background Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Color
    $wp_customize->add_setting('menu_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_color', array('label' => esc_html__('Menu Link Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Hover Color
    $wp_customize->add_setting('menu_hover_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_hover_color', array('label' => esc_html__('Menu Link Hover/Active Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Hover BG Color
    $wp_customize->add_setting('menu_hover_bg_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_hover_bg_color', array('label' => esc_html__('Menu Link Hover/Active BG Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    /* Transparent menu style
     * --------------------------------------*/
    // Header BG Color
    $wp_customize->add_setting('header_t_bg_color', array('sanitize_callback' => 'screenr_sanitize_color_alpha', 'default' => 'rgba(0,0,0,.8)'));
    $wp_customize->add_control(new Screenr_Alpha_Color_Control($wp_customize, 'header_t_bg_color', array('label' => esc_html__('Background Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Color
    $wp_customize->add_setting('menu_t_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_t_color', array('label' => esc_html__('Menu Link Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Hover Color
    $wp_customize->add_setting('menu_t_hover_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_t_hover_color', array('label' => esc_html__('Menu Link Hover/Active Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Hover Color
    $wp_customize->add_setting('menu_t_hover_border_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_t_hover_border_color', array('label' => esc_html__('Menu Link Hover/Active border color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    // Header Menu Hover BG Color
    $wp_customize->add_setting('menu_t_hover_bg_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_t_hover_bg_color', array('label' => esc_html__('Menu Link Hover/Active BG Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    //----------------------------------
    // Site Title Color
    $wp_customize->add_setting('logo_text_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_text_color', array('label' => esc_html__('Site Title Color', 'screenr'), 'section' => 'header_settings', 'description' => esc_html__('Only set if you don\'t use an image logo.', 'screenr'))));
    // Reponsive Mobie button color
    $wp_customize->add_setting('menu_toggle_button_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => ''));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_toggle_button_color', array('label' => esc_html__('Responsive Menu Button Color', 'screenr'), 'section' => 'header_settings', 'description' => '')));
    /* Page Header
       ----------------------------------------------------------------------*/
    // Header background BG Color
    $wp_customize->add_setting('page_header_bg_color', array('sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => '000000'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'page_header_bg_color', array('label' => esc_html__('Background color', 'screenr'), 'section' => 'header_image', 'description' => '')));
    $wp_customize->add_setting('page_header_bg_overlay', array('sanitize_callback' => 'screenr_sanitize_color_alpha', 'default' => ''));
    $wp_customize->add_control(new Screenr_Alpha_Color_Control($wp_customize, 'page_header_bg_overlay', array('label' => esc_html__('Background image overlay color', 'screenr'), 'section' => 'header_image', 'description' => '')));
    // Header page padding top
    $wp_customize->add_setting('page_header_pdtop', array('sanitize_callback' => 'sanitize_text_field', 'default' => '13'));
    $wp_customize->add_control('page_header_pdtop', array('label' => esc_html__('Padding top', 'screenr'), 'section' => 'header_image', 'description' => esc_html__('The page header padding top in percent (%).', 'screenr')));
    // Header page padding top
//.........这里部分代码省略.........
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:101,代码来源:customizer.php


注:本文中的WP_Customize_Manager::register_section_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。