{"id":7011,"date":"2020-04-25T17:37:03","date_gmt":"2020-04-25T17:37:03","guid":{"rendered":"https:\/\/expertwebtechnologies.com\/?p=7011"},"modified":"2025-08-06T06:44:33","modified_gmt":"2025-08-06T06:44:33","slug":"adding-sidebar-in-wordpress-themes-2","status":"publish","type":"post","link":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/","title":{"rendered":"Adding Sidebar in WordPress Themes."},"content":{"rendered":"<h3>How to Add a Custom Sidebar to a WordPress Theme?<\/h3>\n<h4>What&#8217;s a sidebar in WordPress ?<\/h4>\n<p>WordPress Sidebars allow you display all type of widgets inside your theme. And you can use &#8220;sidebars&#8221; to display widgets anywhere you want.All themes by default come with at least one sidebar in it. Sidebar is one of the most used Requirements For many developers.<\/p>\n<p>For adding sidebar we will use one hook and one WordPress function.<\/p>\n<ol>\n<li><b>widgets_init<\/b> hook<\/li>\n<li><b>register_sidebar<\/b> function<\/li>\n<\/ol>\n<h4>About &#8220;register_sidebar&#8221;<\/h4>\n<pre class=\" language-php\"><code class=\" language-php\">\n<span class=\"snip function\">register_sidebar<\/span>( <span class=\"snip keyword\">array<\/span>|<span class=\"snip keyword\">string<\/span> $args = <span class=\"snip keyword\">array<\/span>() )\n<\/code><\/pre>\n<p>It will returns the sidebar ID.<\/p>\n<h4>Parameters<\/h4>\n<p><b>&#8216;name&#8217;<\/b><br \/>\n(string) The name or title of the sidebar displayed in the Widgets interface. Default &#8216;Sidebar $instance&#8217;.<br \/>\n<b>&#8216;id&#8217;<\/b><br \/>\n(string) The unique identifier by which the sidebar will be called. Default &#8216;sidebar-$instance&#8217;.<br \/>\n<b>&#8216;description&#8217;<\/b><br \/>\n(string) Description of the sidebar, displayed in the Widgets interface. Default empty string.<br \/>\n<b>&#8216;class&#8217;<\/b><br \/>\n(string) Extra CSS class to assign to the sidebar in the Widgets interface.<br \/>\n<b>&#8216;before_widget&#8217;<\/b><br \/>\n(string) HTML content to prepend to each widget&#8217;s HTML output when assigned to this sidebar. Default is an opening list item element.<br \/>\n<b>&#8216;after_widget&#8217;<\/b><br \/>\n(string) HTML content to append to each widget&#8217;s HTML output when assigned to this sidebar. Default is a closing list item element.<br \/>\n<b>&#8216;before_title&#8217;<\/b><br \/>\n(string) HTML content to prepend to the sidebar title when displayed. Default is an opening h2 element.<br \/>\n<b>&#8216;after_title&#8217;<\/b><br \/>\n(string) HTML content to append to the sidebar title when displayed. Default is a closing h2 element.<\/p>\n<p><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_sidebar\/\" target=\"blank\" rel=\"noopener noreferrer\">Documentation <\/a><br \/>\nFor adding custom sidebars in WordPress theme Paste the following code in your functions.php file:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"snip keyword\">function<\/span> <span class=\"snip function\">CustomSidebars<\/span>() {\n\u00a0\u00a0$args = <span class=\"snip keyword\">array<\/span>(\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'id'<\/span>            =&gt; <span class=\"snip string\">'custom_sidebar'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'before_title'<\/span>  =&gt; <span class=\"snip string\">'&lt;h4 class=\"widget-title\"&gt;'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'after_title'<\/span>   =&gt; <span class=\"snip string\">'&lt;\/h4&gt;'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'name'<\/span>          =&gt; <span class=\"snip string\">__( 'Newly Added Custom Widget', 'text_domain' )<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'description'<\/span>   =&gt; <span class=\"snip string\">__( 'My First Custom Widget Area', 'text_domain' )<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'before_widget'<\/span> =&gt; <span class=\"snip string\">'&lt;aside id=\"%1$s\" class=\"widget %2$s\"&gt;'<\/span>,\n\u00a0\u00a0\u00a0\u00a0<span class=\"snip string\">'after_widget'<\/span>  =&gt; <span class=\"snip string\">'&lt;\/aside&gt;'<\/span>,\n\u00a0\u00a0);\n\/\/ Register Sidebars\n\u00a0\u00a0<span class=\"snip function\">register_sidebar<\/span>( $args ); \n}\n<span class=\"snip function\">add_action<\/span>(<span class=\"snip string\">'widgets_init'<\/span>,<span class=\"snip string\">'CustomSidebars'<\/span>);\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to Add a Custom Sidebar to a WordPress Theme? What&#8217;s a sidebar in WordPress ? WordPress Sidebars allow you display all type of widgets inside your theme. And you can use &#8220;sidebars&#8221; to display widgets anywhere you want.All themes by default come with at least one sidebar in it. Sidebar is one of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8674,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,36],"tags":[],"class_list":["post-7011","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hooks","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Adding Sidebar in WordPress Themes. - EoXys IT<\/title>\n<meta name=\"description\" content=\"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding Sidebar in WordPress Themes. - EoXys IT\" \/>\n<meta property=\"og:description\" content=\"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\" \/>\n<meta property=\"og:site_name\" content=\"EoXys IT\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-25T17:37:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-06T06:44:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\" \/>\n\t<meta property=\"og:image:width\" content=\"768\" \/>\n\t<meta property=\"og:image:height\" content=\"430\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shiv kumawat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shiv kumawat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\"},\"author\":{\"name\":\"Shiv kumawat\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537\"},\"headline\":\"Adding Sidebar in WordPress Themes.\",\"datePublished\":\"2020-04-25T17:37:03+00:00\",\"dateModified\":\"2025-08-06T06:44:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\"},\"wordCount\":260,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"articleSection\":[\"Hooks\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\",\"name\":\"Adding Sidebar in WordPress Themes. - EoXys IT\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"datePublished\":\"2020-04-25T17:37:03+00:00\",\"dateModified\":\"2025-08-06T06:44:33+00:00\",\"author\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537\"},\"description\":\"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.\",\"breadcrumb\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"width\":768,\"height\":430,\"caption\":\"Code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoxysit.com\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding Sidebar in WordPress Themes.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\",\"url\":\"https:\/\/eoxysit.com\/blogs\/\",\"name\":\"EoXys IT\",\"description\":\"Digitise your business\",\"alternateName\":\"Eoxys It\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537\",\"name\":\"Shiv kumawat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"caption\":\"Shiv kumawat\"},\"description\":\"\\\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\\\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d\",\"sameAs\":[\"https:\/\/eoxysit.com\/\"],\"url\":\"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding Sidebar in WordPress Themes. - EoXys IT","description":"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/","og_locale":"en_US","og_type":"article","og_title":"Adding Sidebar in WordPress Themes. - EoXys IT","og_description":"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.","og_url":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/","og_site_name":"EoXys IT","article_published_time":"2020-04-25T17:37:03+00:00","article_modified_time":"2025-08-06T06:44:33+00:00","og_image":[{"width":768,"height":430,"url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","type":"image\/png"}],"author":"Shiv kumawat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Shiv kumawat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#article","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/"},"author":{"name":"Shiv kumawat","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537"},"headline":"Adding Sidebar in WordPress Themes.","datePublished":"2020-04-25T17:37:03+00:00","dateModified":"2025-08-06T06:44:33+00:00","mainEntityOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/"},"wordCount":260,"commentCount":0,"image":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","articleSection":["Hooks","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/","url":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/","name":"Adding Sidebar in WordPress Themes. - EoXys IT","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage"},"image":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","datePublished":"2020-04-25T17:37:03+00:00","dateModified":"2025-08-06T06:44:33+00:00","author":{"@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537"},"description":"Learn how to add a sidebar in WordPress themes. Customize your website layout with sidebars to display widgets, navigation, or other content for a better user experience.","breadcrumb":{"@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#primaryimage","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","width":768,"height":430,"caption":"Code"},{"@type":"BreadcrumbList","@id":"https:\/\/eoxysit.com\/blogs\/adding-sidebar-in-wordpress-themes-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoxysit.com\/blogs\/"},{"@type":"ListItem","position":2,"name":"Adding Sidebar in WordPress Themes."}]},{"@type":"WebSite","@id":"https:\/\/eoxysit.com\/blogs\/#website","url":"https:\/\/eoxysit.com\/blogs\/","name":"EoXys IT","description":"Digitise your business","alternateName":"Eoxys It","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/2ae37850795ab595577a4bfdb900b537","name":"Shiv kumawat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","caption":"Shiv kumawat"},"description":"\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d","sameAs":["https:\/\/eoxysit.com\/"],"url":"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/"}]}},"_links":{"self":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/7011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/comments?post=7011"}],"version-history":[{"count":0,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/7011\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media\/8674"}],"wp:attachment":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media?parent=7011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/categories?post=7011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/tags?post=7011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}