<?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>eric lightbody &#187; wordpress</title>
	<atom:link href="http://www.ericlightbody.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ericlightbody.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 26 Apr 2010 18:04:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Controlling where the reply goes in your WordPress theme</title>
		<link>http://www.ericlightbody.com/2010/controlling-where-the-reply-goes-in-your-wordpress-theme/</link>
		<comments>http://www.ericlightbody.com/2010/controlling-where-the-reply-goes-in-your-wordpress-theme/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 01:35:29 +0000</pubDate>
		<dc:creator>Eric Lightbody</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.ericlightbody.com/?p=377</guid>
		<description><![CDATA[Here is another nice quick tip for you WordPress fans. I found through some research that it is quite easy to tell WordPress where your comments reply section should go. If you take at one of the comments on my site and hit reply, your reply falls below the comment border like this: I really [...]]]></description>
			<content:encoded><![CDATA[<p>Here is another nice quick tip for you WordPress fans.  I found through some research that it is quite easy to tell WordPress where your comments reply section should go.  If you take at one of the comments on my site and hit reply, your reply falls below the comment border like this:<span id="more-377"></span><br />
<img class="img-border" src="http://www.ericlightbody.com/wp-content/uploads/2010/04/ericlightbodydotcom-comments-reply.jpg" border="0" alt="ericlightbodydotcom comments reply.jpg" width="600" height="643" /><br />
I really don&#8217;t care for the separation, and wanted something more like Chris does over at <a href="http://www.css-tricks.com">css-tricks.com</a></p>
<h3><img class="img-border" src="http://www.ericlightbody.com/wp-content/uploads/2010/04/css-tricksdotcom-comments-reply.jpg" border="0" alt="css-tricksdotcom comments reply.jpg" width="505" height="636" /></h3>
<p>It turns out that this is actually quite easy, but took me some time to find out.</p>
<p>If you have a blog that is supporting comment replies, then in all likelihood you&#8217;ll see the function comment_reply_link in your functions.php file.  In my case, I use Ian Stewart&#8217;s awesome <a href="http://themeshaper.com/wordpress-theme-comments-template-tutorial/">comments template</a> and all of that is already taken care of for me when I create new WordPress themes.  In the <a href="http://codex.wordpress.org/Template_Tags/comment_reply_link">WordPress documentation for the function</a>, they mention the add_below parameter.  That&#8217;s exactly what we need.  Simply put the id of the html element you would like it to fall after.  WordPress tacks on the post id # so that the reply form falls under the correct comment.  In my case, I have one of my comments wrapped like:</p>
<pre class="brush: php;">
&lt;div id=&quot;div-comment-16&quot; class=&quot;comment-content&quot;&gt;&lt;/div&gt;
</pre>
<p>So, my comment_reply_link looks something like this:</p>
<pre class="brush: php;">
			if($args['type'] == 'all' || get_comment_type() == 'comment') :
				comment_reply_link(array_merge($args, array(
					'reply_text' =&amp;amp;gt; __('Reply','shape'),
					'login_text' =&amp;amp;gt; __('Log in to reply.','shape'),
					'depth' =&amp;amp;gt; $depth,
					'before' =&amp;amp;gt; '&amp;amp;lt;div class=&amp;amp;quot;comment-reply-link&amp;amp;quot;&amp;amp;gt;',
					'after' =&amp;amp;gt; '&amp;amp;lt;/div&amp;amp;gt;',
					'add_below' =&amp;amp;gt; 'div-comment'
				)));
			endif;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ericlightbody.com/2010/controlling-where-the-reply-goes-in-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using NextGEN gallery to bring an image gallery to your WordPress blog</title>
		<link>http://www.ericlightbody.com/2010/using-nextgen-gallery-to-bring-an-image-gallery-to-your-wordpress-blog/</link>
		<comments>http://www.ericlightbody.com/2010/using-nextgen-gallery-to-bring-an-image-gallery-to-your-wordpress-blog/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 02:56:49 +0000</pubDate>
		<dc:creator>Eric Lightbody</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.ericlightbody.com/?p=350</guid>
		<description><![CDATA[Bringing a customized image gallery isn&#8217;t as easy as it should be. Many developers have tried to solve this problem, and in my opinion Alex Rabe has done an excellent job of doing so. He has developed a WordPress plugin called NextGEN Galllery which allows the author to easily update and manage photos, and (this [...]]]></description>
			<content:encoded><![CDATA[<p>Bringing a customized image gallery isn&#8217;t as easy as it should be.  Many developers have tried to solve this problem, and in my opinion <a href="http://alexrabe.de/">Alex Rabe</a> has done an excellent job of doing so.  He has developed a WordPress plugin called <a href="http://wordpress.org/extend/plugins/nextgen-gallery/">NextGEN Galllery</a> which allows the author to easily update and manage photos, and (this is important) allow for almost complete customization on how the images are displayed.  As a specific example on how to do this, I&#8217;m going to walk you through getting <a href="http://wordpress.org/extend/plugins/nextgen-gallery/">NextGen gallery</a> and the awesome <a href="http://www.monc.se/kitchen/146/galleria-a-javascript-image-gallery">Galleria jQuery image gallery</a> to get along.<span id="more-350"></span></p>
<p>Once you have the NextGen plugin <a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-installation/">installed and customized</a>, it&#8217;s time to begin getting the gallery to display correctly using a custom template.  Alex talks a <a href="http://nextgen-gallery.com/templates/">bit about templates</a>, but I don&#8217;t think there is enough information for beginning.  The first step with nextGEN templating is to create the folder <strong>nggallery</strong> at the root of your theme&#8217;s directory.  I like to start off with the plugin&#8217;s default gallery file when creating a template.  To do that copy the file gallery.php from the nextGEN plugin directory to your newly created nggallery folder.  Gallery.php can be found here:</p>
<pre class="brush: xml;">wp-content/plugins/nextgen-gallery/view/gallery.php</pre>
<p>You will see the structure of the default gallery in gallery.php, and it will definitely need some changes in order to work with galleria. Galleria needs an unordered list structure for the thumbnails and a div container for the large image.    The most important part of gallery.php is the foreach loop that cycles through all the images and outputs the html to display.  This is how it looks now:</p>
<pre class="brush: php;">
&lt;?php foreach ( $images as $image ) : ?&gt;

 &lt;div id=&quot;ngg-image-&lt;?php echo $image-&gt;pid ?&gt;&quot; &lt;?php echo $image-&gt;style ?&gt; &gt;
 &lt;div &gt;
 &lt;a href=&quot;&lt;?php echo $image-&gt;imageURL ?&gt;&quot; title=&quot;&lt;?php echo $image-&gt;description ?&gt;&quot; &lt;?php echo $image-&gt;thumbcode ?&gt; &gt;
 &lt;?php if ( !$image-&gt;hidden ) { ?&gt;
 &lt;img title=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; alt=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; src=&quot;&lt;?php echo $image-&gt;thumbnailURL ?&gt;&quot; &lt;?php echo $image-&gt;size ?&gt; /&gt;
 &lt;?php } ?&gt;
 &lt;/a&gt;
 &lt;/div&gt;
 &lt;/div&gt;

 &lt;?php if ( $image-&gt;hidden ) continue; ?&gt;
 &lt;?php if ( $gallery-&gt;columns &gt; 0 &amp;&amp; ++$i % $gallery-&gt;columns == 0 ) { ?&gt;
 &lt;br style=&quot;clear: both&quot; /&gt;
 &lt;?php } ?&gt;

 &lt;?php endforeach; ?&gt;
</pre>
<p>We need to change it to output the proper html for galleria like so:</p>
<pre class="brush: php;">
&lt;?php foreach ( $images as $image ) : ?&gt;
 &lt;?php
 $imgCounter = 0;
 if ( !$image-&gt;hidden ) { ?&gt;
 &lt;li&lt;?php if ($imgCounter == 0) : ?&gt;&lt;?php endif; ?&gt;&gt;&lt;img title=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; alt=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; src=&quot;&lt;?php echo $image-&gt;url ?&gt;&quot; /&gt;&lt;/li&gt;
 &lt;?php } ?&gt;

 &lt;?php if ( $image-&gt;hidden ) continue; ?&gt;
 &lt;?php $imgCounter++;?&gt;
 &lt;?php endforeach; ?&gt;
</pre>
<p>Notice how I used $image-&gt;alttext and $image-&gt;url.  With knowing these basic properties, you can pretty much create any html your gallery plugin requires. Here is the full gallery.php file I modified:</p>
<pre class="brush: php;">
&lt;?php
/**
Template Page for the gallery overview

Follow variables are useable :

 $gallery     : Contain all about the gallery
 $images      : Contain all images, path, title
 $pagination  : Contain the pagination content

 You can check the content when you insert the tag &lt;?php var_dump($variable) ?&gt;
 If you would like to show the timestamp of the image ,you can use &lt;?php echo $exif['created_timestamp'] ?&gt;
**/
?&gt;
&lt;?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?&gt;&lt;?php if (!empty ($gallery)) : ?&gt;

 &lt;?php if (is_single()) : //only call full gallery if on single page ?&gt;
 &lt;!-- Thumbnails --&gt;
 &lt;div&gt;&lt;/div&gt; &lt;!-- container for main image --&gt;
 &lt;div&gt;
 &lt;!-- &lt;ul&gt;  --&gt;
 &lt;ul&gt;
 &lt;?php foreach ( $images as $image ) : ?&gt;
 &lt;?php
 $imgCounter = 0;
 if ( !$image-&gt;hidden ) { ?&gt;
 &lt;li&lt;?php if ($imgCounter == 0) : ?&gt;&lt;?php endif; ?&gt;&gt;&lt;img title=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; alt=&quot;&lt;?php echo $image-&gt;alttext ?&gt;&quot; src=&quot;&lt;?php echo $image-&gt;url ?&gt;&quot; /&gt;&lt;/li&gt;
 &lt;?php } ?&gt;

 &lt;?php if ( $image-&gt;hidden ) continue; ?&gt;
 &lt;?php $imgCounter++;?&gt;
 &lt;?php endforeach; ?&gt;
 &lt;/ul&gt;
 &lt;/div&gt;
 &lt;!-- Pagination --&gt;
 &lt;?php echo $pagination ?&gt;

 &lt;?php else : //if on post list then display single image ?&gt;
 &lt;div&gt;
 &lt;img title=&quot;&lt;?php echo $current-&gt;alttext ?&gt;&quot; alt=&quot;&lt;?php echo $current-&gt;alttext ?&gt;&quot; src=&quot;&lt;?php echo $current-&gt;url; ?&gt;&quot; /&gt;
 &lt;/div&gt;
 &lt;?php endif; //list?&gt;

&lt;?php endif; ?&gt;
</pre>
<p>You will need the accompanying javascript and css that go along with the plugin.  Ideally, you only want to call this when a gallery is being displayed.  I haven&#8217;t found a good way of doing this without editing nggallery&#8217;s files directly.  Instead, at least for now, I add these files to the appropriate template files.  In my case, I only needed to add them to single.php since the galleries are only being shown when a single post is being displayed.  If anyone has an idea of how to limit these files to only when they&#8217;re needed, please let me know.</p>
<p>Now all you need to do is call the gallery in your blog post.  This is done with the nggallery shortcode.  Grab the id of the gallery you created, and throw this shortcode:</p>
<pre class="brush: xml;"> [nggallery id=2]</pre>
<p>You do have the option to have multiple gallery templates.  Just create a new php file in your nggallery folder.  Start the name of the file as <strong>gallery-</strong>, like gallery-example1.  Then to use this non-default gallery, call it like this within your post:</p>
<pre class="brush: xml;">[nggallery id =1 template=example1]</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ericlightbody.com/2010/using-nextgen-gallery-to-bring-an-image-gallery-to-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>TweetiePie for WordPress</title>
		<link>http://www.ericlightbody.com/2009/tweetiepie-for-wordpress/</link>
		<comments>http://www.ericlightbody.com/2009/tweetiepie-for-wordpress/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 21:09:44 +0000</pubDate>
		<dc:creator>Eric Lightbody</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.ericlightbody.com/?p=216</guid>
		<description><![CDATA[Download TweetiePie I finished up my new WordPress plugin, and I&#8217;m excited to announce it here. It&#8217;s called TweetiePie and its&#8217; purpose in life is to bring in your most recent updates from twitter and put them on your blog.  This can be done by using a widget or as a direct function call. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img class="align-left img-border" title="Twitter Bird" src="http://www.ericlightbody.com/wp-content/uploads/2009/07/twitter_48.png" alt="Twitter Bird" width="48" height="48" /></p>
<div id="download-tweetiepie" class="list-display-none"><a href="http://wordpress.org/extend/plugins/tweetiepie/"><img title="Download" src="http://www.ericlightbody.com/wp-content/uploads/2009/07/download.png" alt="Download" width="48" height="48" /></a></p>
<h3><a href="http://wordpress.org/extend/plugins/tweetiepie/">Download TweetiePie</a></h3>
</div>
<p>I finished up my new WordPress plugin, and I&#8217;m excited to announce it here.  It&#8217;s called TweetiePie and its&#8217; purpose in life is to bring in your most recent updates from twitter and put them on your blog.  This can be done by using a widget or as a direct function call. It&#8217;s super-easy to get your tweets on the sidebar.  Simply supply your username, how many tweets you would like to display, and whether or not you would like to show the date.  <span id="more-216"></span>Here is a screen-shot of it in action at <a href="http://www.sixmonthexperiment.com">sixmonthexperiment.com</a>:</p>
<p><img class="img-border" title="TweetiePie In Action" src="http://www.ericlightbody.com/wp-content/uploads/2009/07/TweetiePie-In-Action.jpg" alt="TweetiePie in Action" width="542" height="374" /></p>
<p>It also linkifies <a title="Twitter Hash Tags" href="http://twitter.pbworks.com/Hashtags">hash tags</a> and <a title="Twitter @replies" href="http://blog.twitter.com/2008/05/how-replies-work-on-twitter-and-how.html">@replies</a> and properly <a title="Definition of caching" href="http://www.google.com/search?hl=en&amp;client=firefox-a&amp;rls=org.mozilla:en-US:official&amp;hs=dMx&amp;defl=en&amp;q=define:Caching&amp;ei=hndjSpfaCMWGtgfwueT2Dw&amp;sa=X&amp;oi=glossary_definition&amp;ct=title">caches</a>.  In case you didn&#8217;t know, caching is used to minimize the times that your blog has to talk to twitter.  This will speed up your site and<a title="Rate limiting on twitter" href="http://apiwiki.twitter.com/Rate-limiting"> keep twitter happy</a>.   It is called TweetiePie because it uses the <a title="SimplePie" href="http://wordpress.org/extend/plugins/simplepie-plugin-for-wordpress/">SimplePie WordPress plugin</a> to pull the tweets from twitter and cache them.  TweetiePie requires version 2.8 of WordPress or higher.   I&#8217;m not going to say much more than that since all of the technicalities and details are where it resides, in the <a href="http://wordpress.org/extend/plugins/tweetiepie/">WordPress plugin directory</a>.   Please leave all technical questions there and I&#8217;ll leave this space open for comments on how this plugin has helped you, if you absolutely hate it and think I suck, etc. etc. etc.</p>
<p>If you feel so inclined to donate, I&#8217;ll happily use the money to help pay off my student loans.<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="9478580">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.ericlightbody.com/2009/tweetiepie-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Adding multiple sidebars (and other elements) to your wordpress theme</title>
		<link>http://www.ericlightbody.com/2009/adding-multiple-sidebars-and-other-elements-to-your-wordpress-theme/</link>
		<comments>http://www.ericlightbody.com/2009/adding-multiple-sidebars-and-other-elements-to-your-wordpress-theme/#comments</comments>
		<pubDate>Fri, 01 May 2009 03:28:59 +0000</pubDate>
		<dc:creator>Eric Lightbody</dc:creator>
				<category><![CDATA[web-development]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.ericlightbody.com/?p=158</guid>
		<description><![CDATA[I&#8217;m going to show you (you, being the wordpress theme developer or modifier) how to add elements to your blog that will change based on which page you are on. A great example of this is changing which button is on for your navigation to indicate which section is currently active. I will also show [...]]]></description>
			<content:encoded><![CDATA[<p><img class="align-left img-border" title="WordPress Logo" src="http://www.ericlightbody.com/wp-content/uploads/2009/04/wordpress-logo1.png" alt="WordPress Logo" width="48" height="48" />I&#8217;m going to show you (you, being the wordpress theme developer or modifier) how to add elements to your blog that will change based on which page you are on.  A <a href="http://wordpress.org/">great example of this</a> is changing which button is on for your navigation to indicate which section is currently active.   I will also show you how to get multiple widgetized sidebars rocking for your theme.  I&#8217;m going to make the assumption that you already know what <a href="http://codex.wordpress.org/Pages">wordpress pages</a> are and how <a href="http://codex.wordpress.org/User:Lastnode/WordPress_CMS">wordpress can act as a cms</a>.  I will also assume you know how to <a href="http://codex.wordpress.org/Widgetizing_Themes">widgetize your theme</a>. Onwards.<span id="more-158"></span></p>
<h3>Creating multiple dynamic sidebars</h3>
<p>Let&#8217;s take care of a simple task first, creating multiple sidebars.  Normally for a standard wordpress theme you will have this function call to register your dynamic sidebar in your theme&#8217;s function.php file:</p>
<pre class="brush: php;">
if ( function_exists('register_sidebar') )
register_sidebar();
</pre>
<p>That needs to go away.  The code below allows you to create multiple sidebars and name each one uniquely.  Just simply rename &#8216;sidebar#&#8217; and put in as many sidebars as you like.</p>
<pre class="brush: php;">
if ( function_exists('register_sidebar') ) {
register_sidebar(array('name'=&gt;'sidebar1'));
register_sidebar(array('name'=&gt;'sidebar2'));
register_sidebar(array('name'=&gt;'sidebar3'));
}
</pre>
<p>Here is an example of wordpress 2.7.1 using multiple sidebars in the widget screen:</p>
<p><img class="img-border" src="http://www.ericlightbody.com/wp-content/uploads/2009/04/multiple-sidebars-with-widets.png" alt="Multiple Sidebars With Widets" width="317" height="312" /></p>
<p>There is a catch with this.  With multiple sidebars, most likely you are going to want to add the same widget to multiple sidebars.  Some widgets allow you to have multiple instances of the widget on your sidebar(s).  These widgets have a dropdown box in the admin section that allows you to select how many widgets you would like:</p>
<p><img class="img-border" src="http://www.ericlightbody.com/wp-content/uploads/2009/04/widget-selector.png" alt="Widget Selector" width="378" height="95" /></p>
<p>However, most do not.  In this case you need to find the php code for the plugin that initializes the widget.  You will be looking for the <em>register_sidebar_widget</em> call.  For instance, in the <a href="http://wordpress.org/extend/plugins/delicious-cached/">delicious cached</a> plugin, I found this function call:</p>
<pre class="brush: php;">
register_sidebar_widget('Delicious Cached++', 'widget_deliciouspp');
</pre>
<p>All that you need to do is duplicate that line for as many widgets as you need and change the name in the first parameter.  My php code now looks like this:</p>
<pre class="brush: php;">
register_sidebar_widget('Delicious Cached++ 1', 'widget_deliciouspp');
register_sidebar_widget('Delicious Cached++ 2', 'widget_deliciouspp');
register_sidebar_widget('Delicious Cached++ 3', 'widget_deliciouspp');
register_sidebar_widget('Delicious Cached++ 4', 'widget_deliciouspp');
</pre>
<p>Now you should notice your admin interface show multiple instances of the widget like this:</p>
<p><img src="http://www.ericlightbody.com/wp-content/uploads/2009/04/multiple-widgets.png" alt="Multiple Widgets" width="255" height="174" /></p>
<h3>Displaying different sidebars depending what page or subpage you are on</h3>
<p>Now comes the fun part.  Let&#8217;s get those sidebars showing up when you want them to.  You&#8217;re going to want to add this code to your functions.php file.  I won&#8217;t explain what it does until the next part (trust me) (also, thanks to Alberto for this post: <a href="http://www.altrugon.com/php/get-the-top-parent-page-in-wordpress/">http://www.altrugon.com/php/get-the-top-parent-page-in-wordpress/</a>)</p>
<pre class="brush: php;">
function getTopParentPostName($myid) {
$mypage = get_page($myid);

if ($mypage-&gt;post_parent == 0){
return $mypage-&gt;post_name;
}
else{
return getTopParentPostName($mypage-&gt;post_parent);
}
}

function is_tree( $p_name ) {    // $p_name = The page we're looking for pages underneath
global $post;       // We load this as we're outside of the post
$top_post_name = getTopParentPostName($post);

if ( $p_name == $top_post_name ) return true;
else return false;
}
</pre>
<p>Now, normally in order to register a dynamic sidebar for your theme, you just do this in sidebar.php (according to <a href="http://codex.wordpress.org/Widgetizing_Themes">wordpress</a>):</p>
<pre class="brush: php;">
if ( function_exists('register_sidebar') )
register_sidebar();
</pre>
<p>You will be changing it to something like this where main page title # is your main page title name and sidebar# matches your sidebar names as discussed earlier:</p>
<pre class="brush: php;">
if ( is_tree('main page title 1') ) {
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar( 'sidebar1') ) { $generic_sidebar = true; }
}
elseif ( is_tree('main page title 2')) {
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar( 'sidebar2') ) { $generic_sidebar = true; }
}
elseif ( is_tree('main page title 3' )) {
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar( 'sidebar3') ) { $generic_sidebar = true; }
}
</pre>
<p>Here is what&#8217;s happening: the is_tree call checks to see if the current page or subpage you are on is in the family &#8220;main page title #&#8221;.  If it is, then it registers the appropriate sidebar.  That&#8217;s it!  So, sidebars are cool and all, but what about other elements?</p>
<h3>Displaying other elements depending what page or subpage you are on</h3>
<p>This part is easy now that we&#8217;ve got the sidebars done.  Let&#8217;s use an unordered list for top navigation as an example.  I am just adding a class of &#8220;over&#8221; to the active menu item.  You can see that the is_tree function is called again.</p>
<pre class="brush: xml;">
&lt;ul&gt;
&lt;li &lt;?php if ( is_tree('need-a-website') ) echo ' class=&quot;over&quot;'; ?&gt;&gt;&lt;a href=&quot;http://www.google.com&quot;&gt;Google&lt;/a&gt;&lt;/li&gt;
&lt;li &lt;?php if ( is_tree('blogging') ) echo ' class=&quot;over&quot;'; ?&gt;&gt;&lt;a href=&quot;http://www.homestarrunner.com/&quot;&gt;Is not dead&lt;/a&gt;&lt;/li&gt;
&lt;li &lt;?php if ( is_tree('statistics') ) echo ' class=&quot;over&quot;'; ?&gt;&gt;&lt;a href=&quot;http://www.ericlightbody.com&quot;&gt;Coolest website in the universe&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ericlightbody.com/2009/adding-multiple-sidebars-and-other-elements-to-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
	</channel>
</rss>
