Wordpress Theme Customizer - Cannot Add Section / Settings

I am trying to change the settings of the Worpdress theme by adding sections and settings, but no matter what I add to my functions.php file, nothing appears in the setting.

Example:

function starter_customize_register( $wp_customize ) { $wp_customize->add_section( 'mytheme_new_section_name' , array( 'title' => __( 'Visible Section Name', 'starter' ), 'priority' => 30, ) ); } add_action( 'customize_register', 'starter_customize_register'); 

I would expect this to add a section with the selected name, but the only thing I see is the two initial sections from Wordpress (site name and tagline, static front page).

I found a pretty good tutorial here ( http://code.tutsplus.com/series/a-guide-to-the-wordpress-theme-customizer--wp-33722 ). I followed every step and even accepted their example themes, but there again, no new sections or settings are displayed.

It makes me wonder if something is wrong with my configuration.

I am using the wordpress / multisite network, I don’t know if this matches.

Any idea?

Thanks Laurent

+8
php wordpress
source share
1 answer

You need to add settings and controls for them to work:

 function starter_customize_register( $wp_customize ) { $wp_customize->add_section( 'starter_new_section_name' , array( 'title' => __( 'Visible Section Name', 'starter' ), 'priority' => 30 ) ); $wp_customize->add_setting( 'starter_new_setting_name' , array( 'default' => '#000000', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => __( 'Header Color', 'starter' ), 'section' => 'starter_new_section_name', 'settings' => 'starter_new_setting_name', ) ) ); } add_action( 'customize_register', 'starter_customize_register'); 

Link: Theme Settings API .

+17
source share

All Articles