{"id":7894,"date":"2014-03-03T07:21:42","date_gmt":"2014-03-03T12:21:42","guid":{"rendered":"http:\/\/info.template-help.com\/?p=7894"},"modified":"2016-04-18T05:03:00","modified_gmt":"2016-04-18T09:03:00","slug":"how-to-add-widget-area","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/how-to-add-widget-area.html","title":{"rendered":"WordPress. How to add widget area"},"content":{"rendered":"<p>\r\n<\/p>\r\n<p>This tutorial is going to show how to add a new widget area to your WordPress Cherry Framework template.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=AR5PUPHNoFs?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to add widget area<\/a><\/p>\r\n<ol>\r\n<li>\r\n<p>On your FTP, go to the <strong>wp-content\/themes\/CherryFramework<\/strong> folder.<\/p<\/li>\r\n<li>\r\n<p>Open <strong>functions.php<\/strong>.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Hit <strong>Ctrl (Command) + F<\/strong>, search for the following lines:<\/p>\r\n<\/p>\r\n<pre class=\"brush:php\">\r\n\/\/Sidebar\r\ninclude_once (CHILD_DIR . '\/includes\/sidebar-init.php');\r\n<\/pre>\r\n<p>This line defines the <strong>$includes_path<\/strong> variable value:<\/p>\r\n<pre class=\"brush:php\">$includes_path = TEMPLATEPATH . '\/includes\/'; <\/pre>\r\n<p>And shows that the widgets are defined in the <strong>wp-content\/themes\/theme#####\/includes\/sidebar-init.php<\/strong> file<\/p>\r\n<\/li>\r\n<li>\r\n<p>Go to the <strong>wp-content\/themes\/theme#####\/includes <\/strong>folder and open <strong>sidebar-init.php<\/strong> to edit.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Copy the following block of code:<\/p>\r\n<pre class=\"brush:php\">\r\n\/\/ Footer Widget Area\r\n\/\/ Location: at the top of the footer\r\nregister_sidebar(array(\r\n   'name' =&gt; __(&quot;Footer Area&quot;, CURRENT_THEME),\r\n   'id' =&gt; 'footer-sidebar',\r\n   'description' =&gt; theme_locals(&quot;footer_desc&quot;),\r\n   'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot;&gt;',\r\n   'after_widget' =&gt; '&lt;\/div&gt;',\r\n   'before_title' =&gt; '&lt;h4&gt;',\r\n   'after_title' =&gt; '&lt;\/h4&gt;',\r\n));\r\n}\r\n<\/pre>\r\n<p>and paste  it before the closing &lsquo;<strong>}<\/strong>&rsquo; bracket of the <strong>elegance_widgets_init()<\/strong> function.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Change the <strong>&lsquo;name&rsquo;<\/strong>, <strong>&lsquo;id&rsquo;<\/strong> and <strong>&lsquo;description&rsquo;<\/strong> values. Change  the comments:<\/p>\r\n<pre class=\"brush:php\">\r\n\/\/ New Widget Area\r\n\/\/ Location: at the top of the gallery page\r\nregister_sidebar(array(\r\n   'name' =&gt; __(&quot;New Widget Area&quot;, CURRENT_THEME),\r\n   'id' =&gt; 'new-widget-area-sidebar',\r\n   'description' =&gt; __(&quot;New Widget Area&quot;, CURRENT_THEME),\r\n   'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot;&gt;',\r\n   'after_widget' =&gt; '&lt;\/div&gt;',\r\n   'before_title' =&gt; '&lt;h4&gt;',\r\n   'after_title' =&gt; '&lt;\/h4&gt;',\r\n));\r\n}\r\n<\/pre>\r\n<\/li>\r\n<li>\r\n<p>Save the changes to the file. Now, if you go to the <strong>Appearance&gt;Widgets<\/strong> menu  in your admin, the new widget area should be there. Go ahead and add a widget to that area.<\/strong><\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_1-300x135.jpg\" alt=\"wordpress_cherry_new_widget_area_adding_1\" width=\"300\" height=\"135\" class=\"aligncenter size-medium wp-image-33457\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_1-300x135.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_1-150x67.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_1.jpg 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<\/li>\r\n<li>\r\n<p>Now you can insert the widget area to any part of the template. Go back to the &lsquo;<strong>wp-content\/themes\/<\/strong><strong> CherryFramework<\/strong>&lsquo; folder. You can insert the newly created widget area to any of the layout files.<\/p>\r\n<\/li>\r\n<li>\r\n<p>For instance, if you need to add the widget area to the &ldquo;Gallery2&rdquo; page (that uses &#8220;Filter Folio 2 cols&#8221; page template),  copy <strong>page-Portfolio2Cols-filterable.php<\/strong> from the <strong>wp-content\/themes\/CherryFramework <\/strong>folder.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Paste it to the <strong>wp-content\/themes\/theme#####<\/strong>&lsquo; folder and open it to edit.<strong> <\/strong><\/p>\r\n<\/li>\r\n<li>\r\n<p>Paste the following code to the required place to insert the widget area  (where <strong>&lsquo;New Widget Area&rsquo;<\/strong>\u00a0 is your widget  area name) and save the changes:<\/p>\r\n<pre class=\"brush:php\">\r\n  &lt;?php if (!dynamic_sidebar('New Widget Area')) :?&gt; &lt;?php endif;?&gt;\r\n<\/pre>\r\n<\/li>\r\n<li>\r\n<p>If everything was done correctly, the new widget area will be available on the pages that use a page template you added it to.<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_2-300x139.jpg\" alt=\"wordpress_cherry_new_widget_area_adding_2\" width=\"300\" height=\"139\" class=\"aligncenter size-medium wp-image-33458\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_2-300x139.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_2-150x69.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/04\/wordpress_cherry_new_widget_area_adding_2.jpg 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=AR5PUPHNoFs?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to add widget area<\/a><\/p>\r\n<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial is going to show how to add a new widget area to your WordPress Cherry Framework template.<\/p>\n","protected":false},"author":30,"featured_media":33459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[247,728],"tags":[1158,1175,1419,559,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/7894"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=7894"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/7894\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/33459"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=7894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=7894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=7894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}