{"id":6120,"date":"2026-02-13T18:24:31","date_gmt":"2026-02-13T23:24:31","guid":{"rendered":"https:\/\/chubes.net\/?documentation=sidebar-php"},"modified":"2026-03-13T03:29:36","modified_gmt":"2026-03-13T07:29:36","slug":"sidebar-php","status":"publish","type":"documentation","link":"https:\/\/chubes.net\/docs\/wordpress-core\/theme-compat\/sidebar-php\/","title":{"rendered":"sidebar.php"},"content":{"rendered":"<p>Fallback sidebar template for themes that do not provide their own.<\/p><p><strong>Source:<\/strong> <code>wp-includes\/theme-compat\/sidebar.php<\/code><br \/>\n<strong>Deprecated:<\/strong> 3.0.0<br \/>\n<strong>Subpackage:<\/strong> Theme_Compat<\/p><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Purpose<\/h2><p>Loaded by <code>get_sidebar()<\/code> when the active theme has no <code>sidebar.php<\/code>. Outputs a widgetized sidebar with contextual archive information and navigation.<\/p><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Behavior<\/h2><ol class=\"wp-block-list\"><li><p><strong>Calls <code>_deprecated_file()<\/code><\/strong> \u2014 deprecation notice.<\/p><\/li><li><p><strong>Opens <code>&lt;div id=&quot;sidebar&quot; role=&quot;complementary&quot;&gt;<\/code> with a <code>&lt;ul&gt;<\/code>.<\/strong><\/p><\/li><li><p><strong>Dynamic sidebar check:<\/strong> Calls <code>dynamic_sidebar()<\/code> \u2014 if the function doesn&#8217;t exist or returns false (no widgets assigned), outputs the static fallback content below.<\/p><\/li><li><p><strong>Static fallback content (inside the <code>if<\/code> block):<\/strong><\/p>\n<p>a. <strong>Search form<\/strong> via <code>get_search_form()<\/code>.<\/p>\n<p>b. <strong>Commented-out Author section<\/strong> \u2014 HTML comment suggesting an author bio block.<\/p>\n<p>c. <strong>Contextual archive messages<\/strong> \u2014 checks page type and outputs a descriptive paragraph:<\/p><ul class=\"wp-block-list\"><li><code>is_404()<\/code> \u2014 no message (empty block)<\/li><li><code>is_category()<\/code> \u2014 &quot;You are currently browsing the archives for the {category} category.&quot; via <code>single_cat_title()<\/code><\/li><li><code>is_day()<\/code> \u2014 &quot;You are currently browsing the {site} blog archives for the day {date}.&quot; Date formatted with <code>__( 'l, F jS, Y' )<\/code><\/li><li><code>is_month()<\/code> \u2014 &quot;&#8230;archives for {month}.&quot; Date formatted with <code>__( 'F, Y' )<\/code><\/li><li><code>is_year()<\/code> \u2014 &quot;&#8230;archives for the year {year}.&quot; via <code>get_the_time( 'Y' )<\/code><\/li><li><code>is_search()<\/code> \u2014 &quot;You have searched the {site} blog archives for &#8216;{query}&#8217;.&quot; via <code>get_search_query()<\/code><\/li><li><code>is_paged()<\/code> (via <code>$_GET['paged']<\/code>) \u2014 &quot;You are currently browsing the {site} blog archives.&quot;<\/li><\/ul><\/li><li><p><strong>Navigation <code>&lt;ul role=&quot;navigation&quot;&gt;<\/code>:<\/strong><\/p><ul class=\"wp-block-list\"><li><strong>Pages<\/strong> via <code>wp_list_pages()<\/code> with title &quot;Pages&quot;<\/li><li><strong>Archives<\/strong> (monthly) via <code>wp_get_archives( array( 'type' =&gt; 'monthly' ) )<\/code><\/li><li><strong>Categories<\/strong> via <code>wp_list_categories()<\/code> with <code>show_count =&gt; 1<\/code><\/li><\/ul><\/li><li><p><strong>Home\/Page-specific content<\/strong> (when <code>is_home()<\/code> or <code>is_page()<\/code>):<\/p><ul class=\"wp-block-list\"><li><strong>Bookmarks<\/strong> via <code>wp_list_bookmarks()<\/code><\/li><li><strong>Meta section<\/strong> with:<ul class=\"wp-block-list\"><li><code>wp_register()<\/code> \u2014 registration\/admin link<\/li><li><code>wp_loginout()<\/code> \u2014 login\/logout link<\/li><li><code>wp_meta()<\/code> \u2014 meta hook output<\/li><\/ul><\/li><\/ul><\/li><li><p><strong>Closes the sidebar divs.<\/strong><\/p><\/li><\/ol><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Functions Called<\/h2><figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>_deprecated_file()<\/code><\/td><td>Deprecation notice<\/td><\/tr><tr><td><code>__()<\/code>, <code>_e()<\/code><\/td><td>Translation<\/td><\/tr><tr><td><code>sprintf()<\/code>, <code>basename()<\/code><\/td><td>String formatting<\/td><\/tr><tr><td><code>dynamic_sidebar()<\/code><\/td><td>Attempt to render widgets<\/td><\/tr><tr><td><code>get_search_form()<\/code><\/td><td>Search form<\/td><\/tr><tr><td><code>is_404()<\/code>, <code>is_category()<\/code>, <code>is_day()<\/code>, <code>is_month()<\/code>, <code>is_year()<\/code>, <code>is_search()<\/code>, <code>is_paged()<\/code>, <code>is_home()<\/code>, <code>is_page()<\/code>, <code>is_single()<\/code><\/td><td>Conditional tags<\/td><\/tr><tr><td><code>single_cat_title()<\/code><\/td><td>Current category name<\/td><\/tr><tr><td><code>get_bloginfo()<\/code><\/td><td>Site name and URL<\/td><\/tr><tr><td><code>get_the_time()<\/code><\/td><td>Formatted date<\/td><\/tr><tr><td><code>get_search_query()<\/code><\/td><td>Current search query<\/td><\/tr><tr><td><code>esc_html()<\/code><\/td><td>Escape search query for display<\/td><\/tr><tr><td><code>wp_list_pages()<\/code><\/td><td>List pages<\/td><\/tr><tr><td><code>wp_get_archives()<\/code><\/td><td>Monthly archive list<\/td><\/tr><tr><td><code>wp_list_categories()<\/code><\/td><td>Category list with counts<\/td><\/tr><tr><td><code>wp_list_bookmarks()<\/code><\/td><td>Blogroll\/links<\/td><\/tr><tr><td><code>wp_register()<\/code><\/td><td>Registration\/admin link<\/td><\/tr><tr><td><code>wp_loginout()<\/code><\/td><td>Login\/logout link<\/td><\/tr><tr><td><code>wp_meta()<\/code><\/td><td>Sidebar meta hook<\/td><\/tr><\/tbody><\/table><\/figure><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Variables Referenced<\/h2><figure class=\"wp-block-table\"><table><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>$_GET['paged']<\/code><\/td><td>Checked directly (not sanitized) to detect paginated views<\/td><\/tr><\/tbody><\/table><\/figure>","protected":false},"excerpt":{"rendered":"<p>Fallback sidebar template for themes that do not provide their own. Source: wp-includes\/theme-compat\/sidebar.php Deprecated: 3.0.0 Subpackage: Theme_Compat Purpose Loaded by get_sidebar() when the active theme has no sidebar.php. Outputs a&#8230;<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"footnotes":""},"tags":[],"project":[758],"project_type":[749],"class_list":["post-6120","documentation","type-documentation","status-publish","hentry","project-theme-compat","project_type-wordpress-reference"],"project_info":{"id":589,"name":"WordPress Core","slug":"wordpress-core"},"project_type_info":{"id":749,"name":"WordPress Reference","slug":"wordpress-reference"},"_links":{"self":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/6120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/types\/documentation"}],"version-history":[{"count":3,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/6120\/revisions"}],"predecessor-version":[{"id":11040,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/6120\/revisions\/11040"}],"wp:attachment":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/media?parent=6120"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/tags?post=6120"},{"taxonomy":"project","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project?post=6120"},{"taxonomy":"project_type","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project_type?post=6120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}