<?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>Sycha Web Design &#38; Development&#187; WordPress Development Tips, Tutorials and Plugins</title>
	<atom:link href="http://www.sycha.com/resources/web-development/wordpress-development/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sycha.com</link>
	<description>Website Design &#38; Development</description>
	<lastBuildDate>Thu, 02 Sep 2010 21:11:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress Security Tip: Remove Generator Meta Tag (wp_generator)</title>
		<link>http://www.sycha.com/wordpress-security-tip-remove-generator-meta-tag</link>
		<comments>http://www.sycha.com/wordpress-security-tip-remove-generator-meta-tag#comments</comments>
		<pubDate>Thu, 25 Mar 2010 02:56:58 +0000</pubDate>
		<dc:creator>Charlie Evans</dc:creator>
				<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://www.sycha.com/?p=947</guid>
		<description><![CDATA[Sometimes when a security hole is found in WordPress, the cyber-baddies will target specific versions of WordPress that are vulnerable to the exploit. There's no easier way for them to see which version a site is running, than by looking for the "generator" meta tag, which is added by the wp_head() function. ]]></description>
			<content:encoded><![CDATA[<p>Sometimes when a security hole is found in WordPress, the cyber-baddies will target specific versions of WordPress that are vulnerable to the exploit. There&#8217;s no easier way for them to see which version a site is running, than by looking for the &#8220;generator&#8221; meta tag, which is added by the wp_head() function. This tag specifies the WordPress version in it&#8217;s content attribute.</p>
<p>It looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;meta name=&quot;generator&quot; content=&quot;WordPress 2.9.0&quot; /&gt;</pre></div></div>

<p>To remove this meta tag, simply add the following line to your functions.php file in your theme:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_generator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sycha.com/wordpress-security-tip-remove-generator-meta-tag/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Snippet: Display multiple loops on the same page</title>
		<link>http://www.sycha.com/wordpress-snippet-multiple-loops-same-page</link>
		<comments>http://www.sycha.com/wordpress-snippet-multiple-loops-same-page#comments</comments>
		<pubDate>Fri, 11 Dec 2009 22:07:00 +0000</pubDate>
		<dc:creator>Charlie Evans</dc:creator>
				<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://www.sycha.com/?p=503</guid>
		<description><![CDATA[Let's say that on a category page of your WordPress blog, you want to display a secondary list of posts, for example the 3 latest posts from a "featured" category. You have a couple of good options here.]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say that on a category page of your WordPress blog, you want to display a secondary list of posts, for example the 3 latest posts from a &#8220;featured&#8221; category.</p>
<p>You have a couple of good options here:<br />
1. create a new WP_Query object, or<br />
2. use the get_posts() function.</p>
<p><em>Note: Using query_posts() is a bad option as it will upset your &#8220;main loop&#8221;</em></p>
<p>Both take pretty much the same arguments as query_posts() &#8211; <a href="http://codex.wordpress.org/Template_Tags/query_posts#Parameters" target="_blank" rel="nofollow">see a list here.</a></p>
<h3>Example usage of WP_Query:</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$featured_category_id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cat'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$featured_category_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	the_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Example usage of get_posts():</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$featured_category_id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cat'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$featured_category_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>get_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
	the_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sycha.com/wordpress-snippet-multiple-loops-same-page/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Function: in_category_extended()</title>
		<link>http://www.sycha.com/wordpress-function-in-category-extended</link>
		<comments>http://www.sycha.com/wordpress-function-in-category-extended#comments</comments>
		<pubDate>Sun, 29 Nov 2009 22:49:50 +0000</pubDate>
		<dc:creator>Charlie Evans</dc:creator>
				<category><![CDATA[WordPress Development]]></category>

		<guid isPermaLink="false">http://www.sycha.com/?p=175</guid>
		<description><![CDATA[The core WordPress function in_category() is pretty handy but it’s also pretty basic. in_category_extended() is designed to extend the functionality of in_category() by examining descendant categories aswell as the current one.]]></description>
			<content:encoded><![CDATA[<p>The core WordPress function <code>in_category()</code> is pretty handy but it&#8217;s also pretty basic. </p>
<p><code><strong>in_category_extended()</strong></code> is designed to extend the functionality of <code>in_category()</code> in the following ways:</p>
<ol>
<li>test if the current post is assigned to the specified category <strong>OR</strong> any descendant categories</li>
<li>return <strong>TRUE</strong> if you are viewing the specified category page <strong>OR</strong> any descendant category pages</li>
</ol>
<p>Sure, you can do this a bunch of different ways, using multiple functions and code snippets, but I want <strong>a single boolean PHP function</strong> to use in my templates. </p>
<h3>Example Usage</h3>
<p>The main navigation consists of category tabs with on/off states.<br />
If I&#8217;m viewing a post OR a category page which is related to the &#8220;development&#8221; category, then I want to apply a <code>class="current"</code> to the development tab element, which I can then style accordingly with CSS.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">class=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span> in_category_extended<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'development'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'current'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;</pre></div></div>

<h3>Function Definition</h3>
<p><code><strong>bool in_category_extended($category)</strong></code></p>
<p>returns TRUE if the current webpage is related to the specified category</p>
<h3>Function Parameters</h3>
<p><code>$category</code><br />
<em>(mixed) (required)</em> Category specified by ID (integer), or slug (string)</p>
<h3>Function Code</h3>
<p>This function has come in very handy for me &#8211; I hope you find it useful too!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> in_category_extended<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// easy out</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> or is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// retrieve specified category (ID or slug)</span>
	<span style="color: #000088;">$obj_specified_category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> ? get_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> get_category_by_slug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// we're viewing a category</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$current_category_ID</span> <span style="color: #339933;">=</span> get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$current_category_ID</span> or cat_is_ancestor_of<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span><span style="color: #000088;">$current_category_ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// we're viewing a post</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$obj_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_queried_object</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>in_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> in_category<span style="color: #009900;">&#40;</span>get_term_children<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sycha.com/wordpress-function-in-category-extended/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
