<?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>Sandbox Development and Consulting Inc. &#187; WordPress Logic</title>
	<atom:link href="http://www.sandboxdev.com/category/blog/wordpress/wordpress-logic-wordpress-blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sandboxdev.com</link>
	<description>Building Solutions for Your Business Needs.</description>
	<lastBuildDate>Thu, 04 Mar 2010 16:44:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HOWTO: Add a Custom Comment Class to WordPress</title>
		<link>http://www.sandboxdev.com/blog/782/howto-add-a-custom-comment-class-to-wordpress/</link>
		<comments>http://www.sandboxdev.com/blog/782/howto-add-a-custom-comment-class-to-wordpress/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 17:03:20 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[SDAC Blog]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[comment_class]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/?p=782</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/>Ever need to add your own class to your WordPress comment template but not sure how because of the function comment_class that controls the classes?  Check out the function comment_class and you will see adding your own custom classes very easily.  
PLAIN TEXT
PHP:




&#60;?php comment_class&#40;'yourcustomclasshere'&#41;; ?&#62; 






Allow this sounds pretty basic - it is [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/><p>Ever need to add your own class to your WordPress comment template but not sure how because of the function comment_class that controls the classes?  Check out the function <a href="http://codex.wordpress.org/Template_Tags/comment_class" target="_blank">comment_class</a> and you will see adding your own custom classes very easily.  </p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> comment_class<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'yourcustomclasshere'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Allow this sounds pretty basic - it is a lifesaver for doing a lot of customizations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/782/howto-add-a-custom-comment-class-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Conditionally Show Only On Home Page (Front Page)</title>
		<link>http://www.sandboxdev.com/blog/521/conditionally-show-only-on-home-page-front-page/</link>
		<comments>http://www.sandboxdev.com/blog/521/conditionally-show-only-on-home-page-front-page/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 20:59:00 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[SDAC Blog]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WordPress Troubleshooting]]></category>
		<category><![CDATA[Conditional Tags]]></category>
		<category><![CDATA[is_font_page]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/?p=521</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/>There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog).  First - we had the function is_home(), but in WordPress version 2.5 - a new function was introduced: is_front_page(). 
You might think both would conditionally only [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/><p>There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog).  First - we had the function is_home(), but in WordPress version 2.5 - a new function was introduced: is_front_page(). </p>
<p>You might think both would conditionally only display content on the home page (front page, page 1 of your blog) - but you actually need to use the following code to accomplish showing something <strong>ONLY</strong> on the front page of your paged blog:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>is_front_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; !is_paged<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>:<span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;p&gt;Show this text only on the home page&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>;?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So - if you want to easily show something on what I would consider the front page - use the code above to successfully achieve that.  (This is particularly helpful if you have ads that run speficically on the home page and others that are ROS (run of site).</p>
<p><strong>Further reading:</strong></p>
<ul>
<li><a href="http://codex.wordpress.org/Conditional_Tags">documentation on conditional tags</a></li>
<li><a href="http://trac.wordpress.org/ticket/6848">Bug Report on this issue</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/521/conditionally-show-only-on-home-page-front-page/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Get Top Parent Category (WordPress)</title>
		<link>http://www.sandboxdev.com/blog/518/get-top-parent-category-wordpress/</link>
		<comments>http://www.sandboxdev.com/blog/518/get-top-parent-category-wordpress/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 15:28:16 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[Clients]]></category>
		<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[SDAC Blog]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[get_cateogry_parents]]></category>
		<category><![CDATA[jappler.com]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/?p=518</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="Clients" /><br/>There are many times when you need to show or get the top most (root) parent category in WordPress - regardless of how many subcategories you might be deep.  I have used this logic for page navigation (highlight the top parent tab) - as well as within some custom loops/sidebar code.
They way to do [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="Clients" /><br/><p>There are many times when you need to show or get the top most (root) parent category in WordPress - regardless of how many subcategories you might be deep.  I have used this logic for page navigation (highlight the top parent tab) - as well as within some custom loops/sidebar code.</p>
<p>They way to do this:</p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$parentCatList</span> = get_category_parents<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cat</span>,<span style="color:#000000; font-weight:bold;">false</span>,<span style="color:#FF0000;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$parentCatListArray</span> = <a href="http://www.php.net/split"><span style="color:#000066;">split</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">","</span>,<span style="color:#0000FF;">$parentCatList</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$topParentName</span> = <span style="color:#0000FF;">$parentCatListArray</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sdacReplace</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">" "</span> =&gt; <span style="color:#FF0000;">"-"</span>, <span style="color:#FF0000;">"("</span> =&gt; <span style="color:#FF0000;">""</span>, <span style="color:#FF0000;">")"</span> =&gt; <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$topParent</span> = <a href="http://www.php.net/strtolower"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strtr"><span style="color:#000066;">strtr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$topParentName</span>,<span style="color:#0000FF;">$sdacReplace</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To test this you can simply put it in your header and echo out $topParent and you will see the "slug" of the category.<br />
If you want to see the category name and not necessarily the slug - you can simply echo $topParentName.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/518/get-top-parent-category-wordpress/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Show One WordPress Post</title>
		<link>http://www.sandboxdev.com/blog/411/show-one-wordpress-post/</link>
		<comments>http://www.sandboxdev.com/blog/411/show-one-wordpress-post/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 02:47:23 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[SDAC Blog]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[get_post]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/?p=411</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/>There is a great function you might be aware of that allows you to get one WordPress post and display it anywhere you would like (header, sidebar, home page, etc).
To show only one post, use the function get_post.
Example:
PLAIN TEXT
PHP:




&#60;?php $sdac_post_id = 10;


$show_post_id = get_post&#40;$sdac_post_id&#41;; 


$sdac_title = $show_post_id-&#62;post_title;


$sdac_content = $show_post_id-&#62;post_content;


?&#62;


&#60;h2&#62;&#60;?php echo $sdac_title; ?&#62;&#60;/h2&#62;


&#60;?php echo $sdac_content ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/><p>There is a great function you might be aware of that allows you to get one WordPress post and display it anywhere you would like (header, sidebar, home page, etc).</p>
<p>To show only one post, use the function <a href="http://codex.wordpress.org/Function_Reference/get_post">get_post</a>.</p>
<p><strong>Example:</strong></p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#0000FF;">$sdac_post_id</span> = <span style="color:#CC66CC;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$show_post_id</span> = get_post<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sdac_post_id</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sdac_title</span> = <span style="color:#0000FF;">$show_post_id</span>-&gt;<span style="color:#006600;">post_title</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sdac_content</span> = <span style="color:#0000FF;">$show_post_id</span>-&gt;<span style="color:#006600;">post_content</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h2&gt;&lt;?php <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$sdac_title</span>; ?&gt;&lt;/h2&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$sdac_content</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The code above will show the title and content of the post with the post ID of 10.  If you are not sure what your post ID is, go to the manage screen in the WP-Admin, and hover over the post title.  In your browser status bar, you will see the URL - and the post ID is the number at the end of the URL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/411/show-one-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Show Only Category (Not Subcategory) Content</title>
		<link>http://www.sandboxdev.com/blog/wordpress/210/show-only-category-not-subcategory-content/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/210/show-only-category-not-subcategory-content/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 13:12:24 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[conditional]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/?p=210</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/>If you ever wanted to only show the content of the category you were on in the category view of WordPress (instead of the category you are on plus all  of it's subcategories - you can easily do so by adding the code below to the template that is used to show your category [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/><p>If you ever wanted to only show the content of the category you were on in the category view of WordPress (instead of the category you are on plus all  of it's subcategories - you can easily do so by adding the code below to <a href="http://codex.wordpress.org/Template_Hierarchy">the template that is used to show your category content</a></p>
<p>You would start your loop with this:</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#0000FF;">$cat</span> = <a href="http://www.php.net/intval"><span style="color:#000066;">intval</span></a><span style="color:#006600; font-weight:bold;">&#40;</span> get_query_var<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'cat'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span>have_posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : the_post<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>in_category<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cat</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Put your title, content functions here</p>
<p>and where you normally see the
<div class="igBar"><span id="lphp-13"><a href="#" onclick="javascript:showPlainTxt('php-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-13">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endwhile</span>;?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p> call, put
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showPlainTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>;endwhile; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> to close the additional (in_category) if statement.  </p>
<p>This code gets the current category and then only displays categories that are in that category (not sub category)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/210/show-only-category-not-subcategory-content/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Exclude Single Post in WordPress</title>
		<link>http://www.sandboxdev.com/blog/wordpress/180/exclude-single-post/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/180/exclude-single-post/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 18:37:54 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[exclude]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/blog/wordpress/2008/01/16/exclude-single-post.php</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/>If you would like to exclude one post from your blog, archive, search results or wherever you need to on your blog, you can do so by putting in a small piece of code within the particular WordPress loop:
The following example will show all posts except for the post with the ID of 179:
PLAIN TEXT
PHP:




&#60;?php [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/><p>If you would like to exclude one post from your blog, archive, search results or wherever you need to on your blog, you can do so by putting in a small piece of code within the particular WordPress loop:</p>
<p>The following example will show all posts except for the post with the ID of 179:</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showPlainTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>have_posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span>have_posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : the_post<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$post</span>-&gt;<span style="color:#006600;">ID</span> == <span style="color:#FF0000;">'179'</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">continue</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_content<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endwhile</span>;endif;?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This is something that I get a lot of requests for and is very useful in a number of situations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/180/exclude-single-post/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Exclude Single Category in WordPress</title>
		<link>http://www.sandboxdev.com/blog/wordpress/179/exclude-single-category/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/179/exclude-single-category/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 02:35:16 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[exclude]]></category>
		<category><![CDATA[Logic]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/blog/wordpress/2008/01/15/exclude-single-category.php</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/>If you ever need to exclude a single category from a WordPress page (archives, index, category page, etc) you can easily do so by using a little conditional tag code within the WordPress loop.
The example below will skip over any post that is in the category with the ID of 35:
PLAIN TEXT
PHP:




&#60;?php if &#40;have_posts&#40;&#41;&#41; : [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/><p>If you ever need to exclude a single category from a WordPress page (archives, index, category page, etc) you can easily do so by using a little <a href="http://codex.wordpress.org/Conditional_Tags">conditional tag code</a> within the <a href="http://codex.wordpress.org/The_Loop">WordPress loop</a>.</p>
<p>The example below will skip over any post that is in the category with the ID of 35:</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>have_posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span>have_posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : the_post<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>in_category<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'35'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">continue</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_content<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endwhile</span>;endif;?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This can be helpful if you want to not show a particular category in your blog (if you have a category based site setup) - or if you want to hide some categories from your search results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/179/exclude-single-category/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Remove &#8220;Private:&#8221; From WordPress Titles</title>
		<link>http://www.sandboxdev.com/blog/wordpress/178/remove-private-from-wordpress-titles/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/178/remove-private-from-wordpress-titles/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 18:09:00 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[WordPress function]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/blog/wordpress/2008/01/14/remove-private-from-wordpress-titles.php</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/>I needed to be able filter out the text "Private:" for posts and pages that were password protected but did not want to edit any core WordPress files. To filter out that text, I added the following code into my functions.php file (within my theme directory):
PLAIN TEXT
PHP:




function remove_private_prefix&#40;$title&#41; &#123;


$title = str_replace&#40;


'Private:',


'',


$title&#41;;


return $title;


&#125;


add_filter&#40;'the_title','remove_private_prefix'&#41;; 






(I also posted [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/><p>I needed to be able filter out the text "Private:" for posts and pages that were password protected but did not want to edit any core WordPress files. To filter out that text, I added the following code into my functions.php file (within my theme directory):</p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> remove_private_prefix<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$title</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$title</span> = <a href="http://www.php.net/str_replace"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">'Private:'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$title</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <span style="color:#0000FF;">$title</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_filter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'the_title'</span>,<span style="color:#FF0000;">'remove_private_prefix'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>(I also posted <a href="http://wordpress.org/support/topic/116985">this filter</a> in the WordPress Support Forum)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/178/remove-private-from-wordpress-titles/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>WordPress Logic: If Is Logged In</title>
		<link>http://www.sandboxdev.com/blog/wordpress/176/wordpress-logic-if-is-logged-in/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/176/wordpress-logic-if-is-logged-in/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 01:17:57 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[Hints]]></category>
		<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/blog/wordpress/2008/01/07/wordpress-logic-if-is-logged-in.php</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/>There are several tidbits of code that I have collected over the past few years that make it easier and easier to turn a simple WordPress installation into a very functional content management system (CMS).  There are many times when it would be nice to show logged in members certain bits of information (certain [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/wordpress-small.gif" width="25" height="25" alt="" title="WordPress" /><br/><p>There are several tidbits of code that I have collected over the past few years that make it easier and easier to turn a simple WordPress installation into a very functional content management system (CMS).  There are many times when it would be nice to show logged in members certain bits of information (certain categories, posts, or just a simple "Welcome back!") and of course there is a simple way of doing this:
<div class="igBar"><span id="lphp-23"><a href="#" onclick="javascript:showPlainTxt('php-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-23">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>is_user_logged_in<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>: <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That bit of code will allow you to do something like this which will allow you to show the logged in user's preferred user name (selected in the User preferences), and then a list of member only pages (private page parent is page ID 20 - I am showing all sub pages of the members-only pages marked as private). If the user is not logged in, they will get a Welcome visitor! greeting : </p>
<div class="igBar"><span id="lphp-24"><a href="#" onclick="javascript:showPlainTxt('php-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-24">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>is_user_logged_in<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/global"><span style="color:#000066;">global</span></a> <span style="color:#0000FF;">$user_identity</span>;get_currentuserinfo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;p&gt;Welcome back <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$user_identity</span>;?&gt;&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;p&gt;Here is a <a href="http://www.php.net/list"><span style="color:#000066;">list</span></a> of private pages only viewable by Members:&lt;/p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_pages<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'title_li=&amp;child_of=20'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> :<span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Welcome, visitor!</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>;?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can make it as simple as a change in greeting for members and non-members, or put in specific logic like I did with showing the pages.  The potential is limitless.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/176/wordpress-logic-if-is-logged-in/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Search Specific Category in WordPress</title>
		<link>http://www.sandboxdev.com/blog/wordpress/123/search-specific-category-in-wordpress/</link>
		<comments>http://www.sandboxdev.com/blog/wordpress/123/search-specific-category-in-wordpress/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 01:49:33 +0000</pubDate>
		<dc:creator>jzelazny</dc:creator>
				<category><![CDATA[HOWTOs]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Logic]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[WordPress categories]]></category>
		<category><![CDATA[WordPress customizations]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://www.sandboxdev.com/wordpress/2007/10/10/search-specific-category-in-wordpress.php</guid>
		<description><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/>There are some times when you want to limit your search to a particular category, or perhaps multiple categories. This is relatively simple to do in WordPress by adding a hidden field to your search code. (See example below)
PLAIN TEXT
PHP:




&#60;form method="get" id="searchform" action="&#60;?php bloginfo('home'); ?&#62;/"&#62;


&#60;div&#62;&#60;input type="text" value="&#60;?php echo wp_specialchars($s, 1); ?&#62;" name="s" id="s" /&#62;


&#60;input type="hidden" [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.sandboxdev.com/wordpress/wp-content/uploads/icons/sdac-small.gif" width="30" height="25" alt="" title="HOWTOs" /><br/><p>There are some times when you want to limit your search to a particular category, or perhaps multiple categories. This is relatively simple to do in WordPress by adding a hidden field to your search code. (See example below)</p>
<div class="igBar"><span id="lphp-26"><a href="#" onclick="javascript:showPlainTxt('php-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-26">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form method=<span style="color:#FF0000;">"get"</span> id=<span style="color:#FF0000;">"searchform"</span> action=<span style="color:#FF0000;">"&lt;?php bloginfo('home'); ?&gt;/"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div&gt;&lt;input type=<span style="color:#FF0000;">"text"</span> value=<span style="color:#FF0000;">"&lt;?php echo wp_specialchars($s, 1); ?&gt;"</span> name=<span style="color:#FF0000;">"s"</span> id=<span style="color:#FF0000;">"s"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input type=<span style="color:#FF0000;">"hidden"</span> name=<span style="color:#FF0000;">"cat"</span> value=<span style="color:#FF0000;">"22"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input type=<span style="color:#FF0000;">"submit"</span> id=<span style="color:#FF0000;">"searchsubmit"</span> value=<span style="color:#FF0000;">"Search"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/form&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can see I added my hidden input field on the third line.  When I add this in, it then adds onto the query used to search. Your search will go from something like http://www.sandboxdev.com/?s=WordPress to http://www.sandboxdev.com/?s=WordPress&#038;cat=22 and will only return posts in the category ID you choose.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sandboxdev.com/blog/wordpress/123/search-specific-category-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>
