admin管理员组文章数量:1328554
I'm trying to build up a multi sections Customizer in wordpress and when i add the third section in a single panel the first section is set to display: none
don't know what seems to be the issue. If any one can guide me where i'm doing things wrong, thanks in advance.
Steps to reproduce the issue:
Customizer.php inside inc folder in my theme.
<?php
/**
* GYM: Customizer
*
* @package WordPress
* @subpackage GYM
* @since GYM 1.0
*/
/*
Including Customization Support
*/
function mytheme_customize_register( $wp_customize ) {
//All our sections, settings, and controls will be added here
$wp_customize->add_panel('panel_id',array(
'panel'=>'panel_id',
'title'=>__('Theme Options'),
'priority'=>10,
));
// Sections here.
$wp_customize->add_section( 'mytheme_new_section_name' , array(
'panel' => 'panel_id',
'title' => __( 'Visible Section Name', 'mytheme' ),
'priority' => 10,
) );
$wp_customize->add_section('mytheme_new_section', array(
'panel' => 'panel_id',
'title' => __('Second Section Name', 'mytheme'),
'priority' => 20,
));
$wp_customize->add_section('mytheme_new_new_section', array(
'panel' => 'panel_id',
'title' => __('Third Section Name', 'mytheme'),
'priority' => 30,
));
// First Section.
$wp_customize->add_setting(
'primary_color',
array(
'default' => 'default',
'transport' => 'postMessage',
'sanitize_callback' => 'twentynineteen_sanitize_color_option',
)
);
$wp_customize->add_control(
'primary_color',
array(
'type' => 'radio',
'label' => __( 'Primarys Color', 'twentynineteen' ),
'choices' => array(
'default' => _x( 'Default', 'primary color', 'twentynineteen' ),
'custom' => _x( 'Custom', 'primary color', 'twentynineteen' ),
),
'section' => 'mytheme_new_section',
'priority' => 5,
)
);
// Second Section
$wp_customize->add_setting(
'primary_colors',
array(
'default' => 'default',
'transport' => 'postMessage',
'sanitize_callback' => 'twentynineteen_sanitize_color_option',
)
);
$wp_customize->add_control(
'primary_colors',
array(
'type' => 'radio',
'label' => __( 'Primary Text Color', 'gym' ),
'choices' => array(
'default' => _x( 'Default', 'primary color', 'gym' ),
'custom' => _x( 'Custom', 'primary color', 'gym' ),
),
'section' => 'mytheme_new_section_name',
'priority' => 5,
)
);
//Third Section
$wp_customize->add_setting(
'primary_colors',
array(
'default' => 'default',
'transport' => 'postMessage',
'sanitize_callback' => 'twentynineteen_sanitize_color_option',
)
);
$wp_customize->add_control(
'primary_colors',
array(
'type' => 'radio',
'label' => __( 'Primary Updated Text Color', 'gym' ),
'choices' => array(
'default' => _x( 'Default', 'primary color', 'gym' ),
'custom' => _x( 'Custom', 'primary color', 'gym' ),
),
'section' => 'mytheme_new_new_section',
'priority' => 5,
)
);
}
add_action( 'customize_register', 'mytheme_customize_register' );
Here's the result in customizer Options. I'm not able to see the first section " Visible Section Name" in the list.
本文标签: theme developmentCustomizer API Multi Sections in single Panel
版权声明:本文标题:theme development - Customizer API Multi Sections in single Panel 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742260755a2442467.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论