{"id":1500,"date":"2009-12-27T22:01:48","date_gmt":"2009-12-28T03:01:48","guid":{"rendered":"http:\/\/judykat.com\/ken-judy\/?p=1500"},"modified":"2011-02-05T18:17:52","modified_gmt":"2011-02-05T23:17:52","slug":"wordpress-sidebars-pages-search-engine-optimization","status":"publish","type":"post","link":"https:\/\/judykat.com\/ken-judy\/wordpress-sidebars-pages-search-engine-optimization\/","title":{"rendered":"How to make wordpress sidebars only appear on certain pages for search engine optimization"},"content":{"rendered":"<p>I was reading the recommendations in <a href=\"http:\/\/yoast.com\/articles\/wordpress-seo\/\">yoast.com&#8217;s post on wordpress seo<\/a>.<\/p>\n<blockquote><p>Do you really need to link out to all your buddies in your blogroll site wide? Or is it perhaps wiser to just do that on your front page?<\/p><\/blockquote>\n<p>I want to link out on my homepage but I don&#8217;t need my sidebar to extend two screens below the content on my individual post pages.<\/p>\n<p>So, it appears desirable to have elements of the sidebar (e.g. the blogroll and external social networking arcana) only appear on the homepage of my blog.<\/p>\n<p>Thanks to some sample code from <span class=\"removed_link\" title=\"http:\/\/wpcandy.com\/articles\/tutorials\/how-to-make-the-most-out-of-your-sidebar.html\">wpcandy.com<\/span>, this was trivially easy to implement.<\/p>\n<p>I modified the functions.php in my theme to register three sidebars. I called them Top Right Sidebar, Front Page Sidebar, and Bottom Right Sidebar.<\/p>\n<p><code><br \/>\nif ( function_exists('register_sidebar') )<br \/>\tregister_sidebar(array(<br \/>\t\t'name' =&gt; 'Top Right Sidebar',<br \/>\t\t'before_widget' =&gt; '', \/\/ Removes &lt;li&gt;<br \/>\t\t'after_widget' =&gt; '', \/\/ Removes &lt;\/li&gt;<br \/>\t\t'before_title' =&gt; '&lt;h2&gt;',<br \/>\t\t'after_title' =&gt; '&lt;\/h2&gt;',<br \/>\t));<\/p>\n<p>if ( function_exists('register_sidebar') )<br \/>\tregister_sidebar(array(<br \/>\t\t'name' =&gt; 'Front Page Sidebar',<br \/>\t\t'before_widget' =&gt; '', \/\/ Removes &lt;li&gt;<br \/>\t\t'after_widget' =&gt; '', \/\/ Removes &lt;\/li&gt;<br \/>\t\t'before_title' =&gt; '&lt;h2&gt;',<br \/>\t\t'after_title' =&gt; '&lt;\/h2&gt;',<br \/>\t));<\/p>\n<p>if ( function_exists('register_sidebar') )<br \/>\tregister_sidebar(array(<br \/>\t\t'name' =&gt; 'Bottom Right Sidebar',<br \/>\t\t'before_widget' =&gt; '', \/\/ Removes &lt;li&gt;<br \/>\t\t'after_widget' =&gt; '', \/\/ Removes &lt;\/li&gt;<br \/>\t\t'before_title' =&gt; '&lt;h2&gt;',<br \/>\t\t'after_title' =&gt; '&lt;\/h2&gt;',<br \/>\t));<br \/>\n<\/code><\/p>\n<p>Then I modified my sidebar.php to render those three sidebars if the <code>dynamic_sidebar<\/code> function exists also making the <em>Front Page Sidebar<\/em> conditional on <code>is_front_page()<\/code>.<br \/>\n<code><br \/>\n&lt;?php <br \/>if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Top Right Sidebar') ) : else : <br \/>?&gt;<br \/>\n<span style=\"color:#666;\">\/\/default markup for the top sidebar goes here<\/span><br \/>&lt;?php endif; ?&gt;<br \/>\n<span style=\"color:#666;\">\/\/renders only if the current page is the front page, i.e. is_front_page()<\/span><br \/>&lt;?php if ( function_exists('dynamic_sidebar') && <br \/>      is_front_page() && dynamic_sidebar('Front Page Sidebar') ) {} ?&gt;<br \/>\n&lt;?php <br \/>if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Bottom Right Sidebar') ) : else : <br \/>?&gt;<br \/>\n<span style=\"color:#666;\">\/\/default markup for the bottom sidebar goes here<\/span><br \/>&lt;?php endif; ?&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"Wordpress Widget Admin Page\" src=\"http:\/\/judykat.com\/ken-judy\/wp-content\/uploads\/public\/blogimages\/wordpress-widget-sidebar-admin.png\" title=\"Wordpress Widget Admin Page\" class=\"alignright\" width=\"305\" height=\"634\" \/>In my widgets admin I now have three sidebars listed:<\/p>\n<ul>\n<li>They are defined in my theme&#8217;s functions.php. <\/li>\n<li>They render stacked one on top of the other based on the markup in sidebar.php.<\/li>\n<li>I can populate them in the widget admin.<\/li>\n<li> The middle bar only appears on the homepage.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>SEO recommendations are to limit sitewide links. One way to address this is to make blogrolls and other non-contextual links of your WordPress sidebar appear only on the homepage. This is easy to achieve with dynamic sidebars with simple customizations to your blog theme. <a href=\"https:\/\/judykat.com\/ken-judy\/wordpress-sidebars-pages-search-engine-optimization\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[30],"tags":[688,689,101,584,690,112,111,96],"class_list":["post-1500","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-blogroll-site","tag-external-social-networking-arcana","tag-php","tag-search-engine","tag-search-engine-optimization","tag-seo","tag-widget","tag-wordpress"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/posts\/1500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/comments?post=1500"}],"version-history":[{"count":18,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/posts\/1500\/revisions"}],"predecessor-version":[{"id":1518,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/posts\/1500\/revisions\/1518"}],"wp:attachment":[{"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/media?parent=1500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/categories?post=1500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/judykat.com\/ken-judy\/wp-json\/wp\/v2\/tags?post=1500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}