The hook customize_register
is for include all your custom settings to the default core settings. Your code is a good start, Hook, there init a function, there include all settings, and sections. But you register 2 section areas with the same ID; there is wrong. If you will create two different sections on the customizer, then create also two different key, IDs for the sections – $wp_customize->add_section
.
A exmaple:
// Set option key based on get_stylesheet()
$this->theme_key = $args['theme_key'];
$this->option_key = $this->theme_key . '_theme_options';
// ===== Layout Section =====
// Option for leave sidebar left or right
$wp_customize->add_section( $this->option_key . '_layout', array(
'title' => __( 'Layout', 'documentation' ),
'description' => __( 'Define main Layout', 'documentation' ),
'priority' => 30
) );
// ===== Custom Section =====
// create custom section for rewrite url
$wp_customize->add_section( $this->option_key . '_rewrite_url', array(
'title' => __( 'Rewrite', 'documentation' ),
'priority' => 35,
) );
You can create many sections, how yoo want and register also different options per section. Maybe you see on this example for a ready usable solution: