{"id":2829,"date":"2021-06-24T05:02:20","date_gmt":"2021-06-24T09:02:20","guid":{"rendered":"https:\/\/thewpgeek.com\/?p=2829"},"modified":"2021-06-25T09:53:01","modified_gmt":"2021-06-25T13:53:01","slug":"sage-sidebars","status":"publish","type":"post","link":"https:\/\/thewpgeek.com\/sage-sidebars\/","title":{"rendered":"Sage Sidebars"},"content":{"rendered":"\n
In this tutorial, we will be adding a new sidebar called “sidebar-post”, and assign both the primary and new sidebar to various pages. <\/p>\n\n\n\n
We will register the new sidebar in the setup file – this is located in app\/setup.php<\/strong> around line 80. I will add the new “Post Sidebar” to the end of this code, so it now looks like this:<\/p>\n\n\n\n Our new sidebar is now registered in our widget area, go to Appearance\/widgets in your admin panel to make sure it all works correctly, you should see 3 sidebars :<\/p>\n\n\n\nadd_action('widgets_init', function () {\n $config = [\n 'before_widget' => '<section class=\"widget %1$s %2$s\">',\n 'after_widget' => '<\/section>',\n 'before_title' => '<h3>',\n 'after_title' => '<\/h3>',\n ];\n register_sidebar([\n 'name' => __('Primary', 'sage'),\n 'id' => 'sidebar-primary',\n ] + $config);\n register_sidebar([\n 'name' => __('Footer', 'sage'),\n 'id' => 'sidebar-footer',\n ] + $config);\n register_sidebar([\n 'name' => __('Post Sidebar', 'sage'),\n 'id' => 'sidebar-side-post',\n ] + $config);\n});<\/code><\/pre>\n\n\n\n