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
版权声明:本文标题:theme development - Available widgets is not showing up? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738669140a2105888.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论