Widget customizer
-
Hi,
Here is my WordPress customizer code,
Using this code I can add widget in sidebar but after publish customizer sidebar not save that widgets.
$wp_customize->add_panel( 'header_widgets', array( 'type' => 'widgets', 'title' => __( 'Header widgets' ), 'description' => __( 'Header Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ), 'priority' => 116, //'active_callback' => array( $wp_customize, 'is_panel_active' ), 'auto_expand_sole_section' => true, ) ); $wp_customize->add_section( new WP_Customize_Sidebar_Section( $wp_customize, 'header_widget_1', array( 'title' => __( 'Header wiefer', 'mytheme' ), 'priority' => 30, 'panel' => 'header_widgets', 'sidebar_id' => 'homeleft-widgets', ) )); $wp_customize->add_setting( 'header_widget_1_cus', array( 'default' => array(), 'type' => 'widget', //'capability' => 'manage_options', 'render_callback' => array( $wp_customize, 'render_widget_partial' ), ) ); $wp_customize->add_control(new WP_Widget_Area_Customize_Control( $wp_customize, 'header_widget_1_cus', array( //'type' => 'widget', 'section' => 'header_widget_1', 'sidebar_id' => 'homeleft-widgets', 'priority' => ' 3', // place 'Add Widget' and 'Reorder' buttons at end. ) ) );
Thanks.
- The topic ‘Widget customizer’ is closed to new replies.