admin管理员组

文章数量:1203590

I have added theme support in functions.php file.

add_theme_support('widgets');

And register the menu still no available default widget.



class Sidebars{
    public function __construct(){
        $this->setup_hooks();
    }

    protected function setup_hooks(){
        add_action('widgets_init', [$this, 'register_sidebars']);
    }

    public function register_sidebars(){
        register_sidebar( array(
            'name'          => __( 'Main Sidebar', 'textdomain' ),
            'id'            => 'sidebar-1',
            'description'   => __( 'Widgets in this area will be shown on all posts and pages.', 'textdomain' ),
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget'  => '</li>',
            'before_title'  => '<h2 class="widgettitle">',
            'after_title'   => '</h2>',
        ) );

    }
}

$sidebar = new Sidebars();

Here is my full code

I am not an expert but there suppose to have an option of available widgets. What am I missing?

本文标签: theme developmentAvailable widgets is not showing up