<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Market By Numbers &#187; sidebar</title>
	<atom:link href="http://market-by-numbers.com/tag/sidebar/feed/" rel="self" type="application/rss+xml" />
	<link>http://market-by-numbers.com</link>
	<description>High-Tech Marketing and Customer Development</description>
	<lastBuildDate>Fri, 16 Mar 2012 00:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>WordPress: Using a different sidebar for static pages</title>
		<link>http://market-by-numbers.com/2009/12/wordpress-using-a-different-sidebar-for-static-pages/</link>
		<comments>http://market-by-numbers.com/2009/12/wordpress-using-a-different-sidebar-for-static-pages/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 08:15:32 +0000</pubDate>
		<dc:creator>brantcooper</dc:creator>
				<category><![CDATA[Sales and Marketing Roadmap]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://market-by-numbers.com/?p=724</guid>
		<description><![CDATA[And now for something completely different. Lessee if I can earn some techy bone fides. Like many blogs, my sidebar is filled with blog-related functionality, e.g., search box, RSS, feed, blog navigational tools, etc., that isn&#8217;t particularly relevant to my static pages. So I wanted to use a different sidebar for the static pages.   If [...]]]></description>
			<content:encoded><![CDATA[<p>And now for something completely different.  Lessee if I can earn some techy bone fides.</p>
<p>Like many blogs, my sidebar is filled with blog-related functionality, e.g., search box, RSS, feed, blog navigational tools, etc., that isn&#8217;t particularly relevant to my static pages.  So I wanted to use a different sidebar for the static pages.   If you look at my sidebar on this page, it includes typical blog sidebar stuff.  But if you go to the  &#8220;<a href="/marketing-help/" target="_blank">Marketing Help</a>&#8221; page, you&#8217;ll see a completely different sidebar!</p>
<p>Easy enough, I suppose, for WordPress experts and easy enough to ascertain, for the technically-gifted.  It took me a little while, however, to navigate through the steps and so I thought I would share.  Again, I am no expert, so I can&#8217;t say for sure I&#8217;ve done it the best way or the &#8220;right&#8221; way, but it works for me and I think these steps are pretty easy.  This assumes, by the way, that you are hosting WordPress yourself.  These instructions might also vary by WordPress version and by theme.</p>
<p>So here goes:<br />
<span id="more-724"></span><br />
1)  Create a copy of your existing sidebar.php file, that lives in this directory:  [domain]/wp-content/themes[your theme name]/  (You can do this with an ftp or shell client.)<br />
2)  Name the copy something useful, but keep &#8220;sidebar&#8221; in the name and include a &#8220;dash&#8221; after &#8220;sidebar.&#8221;  I called mine &#8220;sidebar-custom.php&#8221; (You can do this with an ftp or shell client.)<br />
3)  You have to register this new sidebar, so you must edit your functions.php file. (You can do this inside wp-admin, by going to Appearance | Editor and choosing the functions.php file.)<br />
4)  Inside functions.php, you will likely find reference to the register_sidebar function.  Specifically, look for:</p>
<blockquote><p>if(function_exists(&#8216;register_sidebar&#8217;)) {<br />
register_sidebar(array(<br />
&#8216;name&#8217; =&gt; __(&#8216;Sidebar&#8217;),<br />
&#8216;before_widget&#8217; =&gt; &#8221;,<br />
&#8216;after_widget&#8217; =&gt; &#8221;,<br />
&#8216;before_title&#8217; =&gt; &#8221;,<br />
&#8216;after_title&#8217; =&gt; &#8221;<br />
));</p></blockquote>
<p>You want to add a reference to your new &#8220;sidebar-custom.php&#8221; file.   So after the &#8220;));&#8221; above, add:</p>
<blockquote><p>register_sidebar(array(<br />
&#8216;name&#8217; =&gt; (&#8216;custom&#8217;),<br />
&#8216;before_widget&#8217; =&gt; &#8221;,<br />
&#8216;after_widget&#8217; =&gt; &#8221;,<br />
&#8216;before_title&#8217; =&gt; &#8221;,<br />
&#8216;after_title&#8217; =&gt; &#8221;<br />
));</p></blockquote>
<p>Notice that it&#8217;s the same, except I&#8217;ve named this sidebar with the name of the file after &#8220;sidebar-&#8221;, i.e. the root name.  Be sure you have a closing bracket, &#8220;}&#8221; after this last bit, which closes the &#8220;if statement&#8221; shown above.  Update the file.</p>
<p>5. If you now navigate to your WordPress Widgets management page within wp-admin, Appearance | Widgets, you should see a second sidebar on the right hand side labeled whatever you called your custom sidebar.  Mine is simply called &#8220;custom.&#8221;  You can now drag widgets to the new sidebar.  But, you&#8217;re not done yet.  : )</p>
<p>6. Go back to the theme editor, Appearance | Editor and find your new sidebar-custom.php file and open it.</p>
<p>7. This file controls what widgets will appear in this sidebar.  Most widgets these days are &#8220;dynamic,&#8221; in that they are built on the fly when requested by the user browsing your pages.  Inside this file, look for the line:</p>
<blockquote><p>if ( !function_exists(&#8216;dynamic_sidebar&#8217;) || !dynamic_sidebar(1) ) : ?&gt;</p></blockquote>
<p>This line essentially says &#8220;if the function &#8216;dynamic_sidebar&#8217; doesn&#8217;t exist OR if the default sidebar.php file doesn&#8217;t exist, then display the static text that follows,&#8221; which is followed by html code that will be displayed.  My template was actually written in the inverse, which said &#8220;if the function DOES exist AND the sidebar file DOES exit, then do nothing, otherwise write the static code.  I like the version above better, so changed to that.</p>
<p>Change the dynamic_sidebar value to dynamic_sidebar(&#8216;custom&#8217;), so the line looks like:</p>
<blockquote><p>if ( !function_exists(&#8216;dynamic_sidebar&#8217;) || !dynamic_sidebar(&#8216;custom&#8217;) ) : ?&gt;</p></blockquote>
<p>where &#8216;custom&#8217; is the root name again you used in the new sidebar filename.  Update the file.</p>
<p>8.  Now, where do you want to put your new sidebar?  I wanted to leave my posts alone, but change the sidebar for just my pages.  So the final step is to open the page.php file in the Appearance editor and change &lt;?php get_sidebar(); ?&gt; to &lt;?php get_sidebar(&#8216;custom&#8217;); ?&gt;.</p>
<p>Update the file and you should be all set.</p>
<p>There are all sorts of functions you can use to more precisely control where to put the sidebar.  See <a href="http://codex.wordpress.org/Conditional_Tags" target="_blank">here</a>.</p>
<p>References:</p>
<p><a href="http://codex.wordpress.org/Customizing_Your_Sidebar#New_way_of_adding_sidebars" target="_blank">Customizing Your Sidebar</a><br />
<a href="http://codex.wordpress.org/WordPress_Widgets_Api/dynamic_sidebar">Function Reference/dynamic sidebar</a><br />
<a href="http://codex.wordpress.org/WordPress_Widgets_Api/register_sidebar">Function Reference/register sidebar</a><br />
<a href="http://wordpress.org/support/topic/283661"> Two widgetized sidebars </a><br />
<a href="http://wordpress.org/support/topic/328547">How to Create new Widget Area</a></p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" class="tt" href="http://twitter.com/home/?status=WordPress%3A+Using+a+different+sidebar+for+static+pages+http%3A%2F%2Fmarket-by-numbers.com%2F%3Fp%3D724" title="Share on Twitter"><img class="nothumb" src="http://market-by-numbers.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://market-by-numbers.com/2009/12/wordpress-using-a-different-sidebar-for-static-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

