<?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>WordpressHero</title>
	<atom:link href="http://wordpresshero.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpresshero.com</link>
	<description>Taking you from Wordpress Hell to Wordpress Heaven.</description>
	<lastBuildDate>Sun, 04 Apr 2010 23:52:38 +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>Secure A Wordpress Blog</title>
		<link>http://wordpresshero.com/hacks/secure-a-wordpress-blog.html/</link>
		<comments>http://wordpresshero.com/hacks/secure-a-wordpress-blog.html/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 12:31:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Angsuman's Authenticated WordPress Plugin]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[secure wordpress blog]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=68</guid>
		<description><![CDATA[The basic installation of Wordpress does not provide a feature to make the entire wordpress blog private. Yes &#8211; you can block search engines and Yes you can opt to disable pinging update services when you publish new content; but that&#8217;s not completely private. By &#8220;private&#8221; we mean a Wordpress blog that is only viewable [...]]]></description>
			<content:encoded><![CDATA[<p>The basic installation of Wordpress does not provide a feature to make the entire wordpress blog private. Yes &#8211; you can block search engines and Yes you can opt to disable pinging update services when you publish new content; but that&#8217;s not completely private. By &#8220;private&#8221; we mean a Wordpress blog that is only viewable to those with a username and password.</p>
<dl class="photo peace">
<dd><img src="http://wordpresshero.com/wp-content/uploads/2008/11/wordpress-login2.png" alt="" /></dd>
<dt>So if we want to make a Wordpress blog private and ensure that only logged in users can view content we need to direct users not logged in to the login screen, like above.</dt>
</dl>
<h3>How can we secure a wordpress blog then?</h3>
<p><span id="more-68"></span></p>
<p>There are a number of ways.</p>
<p>All are hacks.</p>
<p>The easiest and best and the one we are going to look at involves a plugin. A plugin called &#8220;<a href="http://blog.taragana.com/index.php/archive/angsumans-authenticated-wordpress-plugin-password-protection-for-your-wordpress-blog/">Angsuman&#8217;s Authenticated WordPress plugin</a>&#8220;. This plugin checks to see if the person viewing a Wordpress blog is logged in or not &#8211; if they are not logged in they are redirected to the login screen, if they are logged in then fantastic, they can then view the Wordpress blog&#8217;s content. Essentially it does the job we are looking at accomplishing here &#8211; <strong>securing a Wordpress blog and thus making it private to the general public and only accessible to logged in users</strong>.</p>
<h3>But there is a &#8220;<strong>but</strong>&#8220;</h3>
<p>Angsuman&#8217;s Authenticated WordPress plugin does not work with Wordpress 2.5 and upwards. It was released at the end of 2005 and since then a few major Wordpress upgrades have been releases; most notably Wordpress 2.5 which is when Angsuman&#8217;s Authenticated WordPress plugin stopped working. No problem: Every problem has a solution. And Angsuman&#8217;s Authenticated WordPress Plugin is no different.</p>
<p>So let&#8217;s fix it.</p>
<p>I wanted to make sure I made it as easy for you to get this plugin working with Wordpress 2.5, or 2.6 or whatever so instead of telling you to cut and paste sections of code I have just included the entire updated code. Simple replace the all of the code in &#8216;ac-authenticated.php&#8217; with the following:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="coMULTI">/*<br />
Plugin Name: Angsuman&#8217;s Authenticated WordPress Plugin<br />
Plugin URI: http://blog.taragana.com/index.php/archive/angsumans-authenticated-wordpress-plugin-password-protection-for-your-wordpress-blog/<br />
Description: This plugin allows you to make your WordPress site accessible to logged in users only. In other words to view your site they have to create / have an account in your site and be logged in. No configuration necessary. Simply activating the plugin is all that is required from you.<br />
Author: Angsuman Chakraborty, Taragana<br />
Version: 1.0<br />
Author URI: http://blog.taragana.com/<br />
License: Free to use non-commercially.<br />
Warranties: None.<br />
*/</span><br />
<span class="kw2">function</span> ac_auth_redirect<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="co1">// Checks if a user is logged in, if not redirects them to the login page</span><br />
<span class="kw2">global</span> <span class="re0">$user_ID</span><span class="sy0">;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$user_ID</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
nocache_headers<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">&#40;</span><span class="st0">&quot;HTTP/1.1 302 Moved Temporarily&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">&#40;</span><span class="st_h">&#8216;Location: &#8216;</span> <span class="sy0">.</span> get_settings<span class="br0">&#40;</span><span class="st_h">&#8217;siteurl&#8217;</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st_h">&#8216;/wp-login.php?redirect_to=&#8217;</span> <span class="sy0">.</span> <a href="http://www.php.net/urlencode"><span class="kw3">urlencode</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;REQUEST_URI&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">&#40;</span><span class="st0">&quot;Status: 302 Moved Temporarily&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<a href="http://www.php.net/exit"><span class="kw3">exit</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">if</span><span class="br0">&#40;</span><span class="st_h">&#8216;wp-login.php&#8217;</span> <span class="sy0">!=</span> <span class="re0">$pagenow</span> <span class="sy0">&amp;</span>amp<span class="sy0">;&amp;</span>amp<span class="sy0">;</span> <span class="st_h">&#8216;wp-register.php&#8217;</span> <span class="sy0">!=</span> <span class="re0">$pagenow</span><span class="br0">&#41;</span> add_action<span class="br0">&#40;</span><span class="st_h">&#8216;template_redirect&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;ac_auth_redirect&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
?<span class="sy0">&amp;</span>gt<span class="sy0">;</span></div>
</div>
<p>&#8230; Then upload into your &#8220;wp-content/plugins&#8221; folder and activate and boom &#8211; your Wordpress blog will be private and secured. Easy peazy.</p>
<h3>Download Updated Angsuman&#8217;s Authenticated WordPress Plugin</h3>
<p>If you want to just download the updated &#8220;Angsuman&#8217;s Authenticated WordPress Plugin&#8221; get it from the download link below:</p>
<blockquote class="download">
<h3><a href="/files/ac_authenticator.zip">Download updated &#8220;Angsuman&#8217;s Authenticated WordPress Plugin&#8221;</a></h3>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/hacks/secure-a-wordpress-blog.html/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Add .html extension to permalinks</title>
		<link>http://wordpresshero.com/tricks/add-html-extension-to-permalinks.html/</link>
		<comments>http://wordpresshero.com/tricks/add-html-extension-to-permalinks.html/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 07:48:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[.html]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[kudos]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[permalinks]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=46</guid>
		<description><![CDATA[

1. Standard permalink structure.
2. Permalink structure with .HTML extension at end &#8211; the uber cool permalink structure.

Most Wordpress blogs, use a common permalink structure. They use one like the first shown above:

/%category%/%postname%/

&#8230; or more simply a lot of wordpress blogs just use:

/%postname%/

These two permalink structures are boring, like I said they are &#8220;common&#8220;. But if [...]]]></description>
			<content:encoded><![CDATA[<dl class="photo">
<dd><img src="http://wordpresshero.com/wp-content/uploads/2008/11/htmlpermalinks.png" alt="" title="htmlpermalinks" /></dd>
<dt><strong>1.</strong> Standard permalink structure.</dt>
<dt><strong>2.</strong> Permalink structure with .HTML extension at end &#8211; the uber cool permalink structure.</dt>
</dl>
<p>Most Wordpress blogs, use a <strong>common</strong> permalink structure. They use one like the first shown above:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/%category%/%postname%/</div>
</div>
<p>&#8230; or more simply a lot of wordpress blogs just use:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/%postname%/</div>
</div>
<p>These two permalink structures are boring, like I said they are &#8220;<strong>common</strong>&#8220;. But if something is <em>common</em>, that&#8217;s a bad sign isn&#8217;t it, yes? Yes it is. When something is <em>common </em>it shows that it is <strike>fashionable</strike>. Stuff <strike>fashion</strike>, let&#8217;s be creative, let&#8217;s be cool.</p>
<p><span id="more-46"></span></p>
<h3>So what&#8217;s the coolest permalink structure?</h3>
<p>I don&#8217;t know what the coolest permalink structure is &#8211; perhaps you can argue among yourselves. But I do know of some cool permalink structures. And one of the most hip permalink structures is the following:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/%category%/%postname%.html/</div>
</div>
<h3>So what? Why should I care? What&#8217;s the difference Mr Wordpress Hero?</h3>
<p>Ok, ok. Keep your pants on. The difference is that at the end of permalinks the &#8220;.html&#8221; extension will be added.</p>
<h3>Yeah but who cares? What&#8217;s the benefit of having &#8220;.html&#8221; at the end of permalinks?</h3>
<p>Google cares. So does MSN and Yahoo maybe. They care enough to give you extra kudos, maybe not a lot, but extra kudos nonetheless. The reason why you will get more kudos from the major search engines for using &#8220;.html&#8221; or any similar extension in your permalinks is well because of two main reasons:</p>
<ol>
<li><strong>The <em>Static</em> look</strong>. The &#8220;.html&#8221; extension makes your blog posts and pages appear to be <em>static</em>. Using &#8220;.html&#8221; will encourage spiders to come and crawl your site more frequently. While you could use &#8220;.php&#8221; as an extension for your pages, because of this benefit &#8211; &#8216;the static look&#8217; &#8211; , it&#8217;s not recommended &#8220;.php&#8221; in your permalink would tell the search engines that your content is dynamic and so search engine spiders may limit the frequency they check out your website.</li>
<li><strong>A higher level</strong>. Consider this, imagine you have a blog post entitled, &#8220;How To Make A Million Dollars In 1 Year&#8221; in a category called &#8220;make money online&#8221;, let&#8217;s compare how that post&#8217;s permalink would differ:
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/make-money-online/how-to-make-a-million-dollars-in-1-year/</div>
</div>
<p>or</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/make-money-online/how-to-make-a-million-dollars-in-1-year.html/</div>
</div>
<p>The latter&#8217;s permalink is superior. Why? Because it is considered 1-level higher than the first therefore is given extra kudos by google.
</li>
</ol>
<h3>Ok. Let&#8217;s do this on my wordpress site right now!</h3>
<p>Cool. To make the permalink structure of your blog add &#8220;.html&#8221; as an extension to permalinks, thus moving your posts one level higher and giving them a statuc look that will earn you extra kudos from the search engines. Follow the following two steps:</p>
<blockquote class="indented">
<h3><span class="count">1</span> Change Permalink Structure</h3>
<p>Change your permalink structure to the following:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">/%category%/%postname%.html/</div>
</div>
<h3><span class="count">2</span> Download and Activate The &#8220;.html&#8221; on pages Wordpress Plugin&#8221;.</h3>
<p>By default in wordpress, your &#8220;/%category%/%postname%.html/&#8221; permalink structure will only apply to blog posts &#8211; so we are going to require a plugin for pages. Right, ok. Easy. Go download and activate the &#8220;<a href="http://www.introsites.co.uk/33~html-wordpress-permalink-on-pages-plugin.html">html on pages</a>&#8221; wordpress plugin.</p>
</blockquote>
<p>That&#8217;s it. Easy. Have fun. Keep it real. And enjoy the extra kudos the major search engines will give to your Wordpress blog for having the &#8220;.html&#8221; extension in permalinks.</p>
<p>P.S. Just in case you&#8217;re a slacker and you&#8217;re crying right now, and whinging that &#8220;this is not going to make a massive different to my SEO efforts and get me on page 1 position 1 within 1 hour.&#8221; Let me tell you, if that is you (you slacker) you would be right. But remember what SEO is. SEO is a bunch of tweaks that when combined together can equal something substancial. Don&#8217;t believe me? Slacker. Here is what google say about SEO:</p>
<blockquote class="pquote">
<p>Search engine optimization is often about making small modifications to parts of your website. When viewed individually, these changes might seem like incremental improvements, but when combined with other optimizations, they could have a noticeable impact on your site&#8217;s user experience and performance in organic search results.</p>
</blockquote>
<p>P.P.S. The above quote is taken from the first page of Google&#8217;s recently released Search Engine Optimization Starter guide. You can download your copy by right clicking and saving the below link to your hard drive.</p>
<blockquote class="download-pdf"><h3>
<a href="http://www.google.com/webmasters/docs/search-engine-optimization-starter-guide.pdf">Download Google&#8217;s Search Engine Optimization Starter Guide</a><br />
</h3>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/tricks/add-html-extension-to-permalinks.html/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Full Width and Height Images Uploads</title>
		<link>http://wordpresshero.com/tricks/full-width-and-height-images-uploads.html/</link>
		<comments>http://wordpresshero.com/tricks/full-width-and-height-images-uploads.html/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 21:52:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=34</guid>
		<description><![CDATA[
By default, the image upload tool build into Wordpress creates thumbnail images. So when the user clicks &#8220;send to editor&#8221; the image rendered will be a thumbnail  of the original image uploaded. Wordpress renders this by placing &#8220;.thumbnail&#8221; The file &#8220;/wp-admin/inline-uploading.php&#8221; is used to render image thumbnails. Lines 81-85 dictate a maximum width of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.alanwho.com/wp-admin/images/wordpress-logo.png" alt="Wordpress" /></p>
<p>By default, the image upload tool build into Wordpress creates thumbnail images. So when the user clicks &#8220;<strong>send to editor</strong>&#8221; the image rendered will be a thumbnail  of the original image uploaded. Wordpress renders this by placing &#8220;<em>.thumbnail</em>&#8221; <footnote>The file &#8220;<em>/wp-admin/inline-uploading.php</em>&#8221; is used to render image thumbnails. Lines <strong>81</strong>-<strong>85</strong> dictate a maximum width of <strong>128</strong> pixels or a maximum height of <strong>96</strong> pixels. Perhaps in future versions of Wordpress the width and height pixel values will be an option in the Wordpress administration.</footnote> after the image name and between the image extension:</p>
<p><span id="more-34"></span></p>
<blockquote>
<div class="codesnip-container" >image1.thumbnail.jpg</div>
</blockquote>
<p>But often users of Wordpress do not want their images resized to pre-determined dimensions and some even use FTP <footnote><a href="http://en.wikipedia.org/wiki/Ftp">File Transfer Protocol</a></footnote> to transfer their images. I used to do this for a while then I realized the Wordpress image upload tool could be used to upload images at original width and height dimensions. Obviously this is much better than FTP, as the browser is quicker and easier. Also the Wordpress upload tool is actually quite intelligent especially noting the fact that it organizes uploads into date dependent permalink archives.</p>
<h3>Step 1: <em>Browse</em> and <strong>Upload</strong></h3>
<p><img id="image32" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinposts1.jpg" alt="Screenshot 1." /><br />
Browse to the location of your image on your hard drive, fill in a &#8220;<em>title</em>&#8221; and &#8220;<em>description</em>&#8221; and hit &#8220;<strong>upload</strong>&#8221; &#8230;</p>
<h3>Step 2: Review The Uploaded Image and access the Image Menu</h3>
<p><img id="image33" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinposts2.jpg" alt="Screenshot 2." /><br />
The image should now be uploaded. Click the image with the left mouse button to reveal a menu &#8230;</p>
<h3>Step 3: Observe the Image Menu That Has Now Appeared</h3>
<p><img id="image34" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinposts3.jpg" alt="Screenshot 3." /><br />
A menu should now be visible partially obscuring the uploaded image. The menu options are:</p>
<ul>
<li>Using Thumbnail</li>
<li>Not Linked</li>
<li>Send To Editor</li>
<li>Delete</li>
<li>Close Options</li>
</ul>
<h3>Step 4: Wordpress Thumbnail to Original Image</h3>
<p><img id="image35" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinposts4.jpg" alt="Screenshot 4." /><br />
Click on the &#8220;<strong>Using thumbnail</strong>&#8221; option. This will change the option to &#8220;<strong>Using Original</strong>&#8221; &#8230;</p>
<h3>Step 5: Send To Editor</h3>
<p>
<img id="image36" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinposts5.jpg" alt="Screenshot 5." /><br />
<br />
Now click &#8220;<strong>Send to Editor</strong>&#8220;. This will send the relevent XHTML <footnote><a href="http://en.wikipedia.org/wiki/Xhtml">Extensible HyperText Markup Language</a></footnote> code straight to the Wordpress editor box &#8230;</p>
<h3>Final Page/Post</h3>
<p>
<a href="http://www.alanwho.com/example-image-thumbnail-page/"><img id="image38" src="http://www.alanwho.com/wp-content/uploads/2006/07/imagesinpostfinal2.jpg" alt="Original Size" /></a><br />
And there it is the final post/page with an image uploaded using the Wordpress Image upload tool displayed using the original dimensions. Beautiful.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/tricks/full-width-and-height-images-uploads.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Different Single Post Pages In Wordpress</title>
		<link>http://wordpresshero.com/tricks/different-single-post-pages-in-wordpress.html/</link>
		<comments>http://wordpresshero.com/tricks/different-single-post-pages-in-wordpress.html/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 21:51:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=32</guid>
		<description><![CDATA[
By default all Wordpress posts viewed as a single post are controlled by the particular theme&#8217;s &#8220;single.php&#8221; file.
Wordpress, by default is setup to use one template file (&#8220;single.php&#8220;) for every post.(But what if you wanted to display a different layout or different code dependent on the specific categories a post or filed into?
To do this [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.alanwho.com/wp-admin/images/wordpress-logo.png" alt="Wordpress" /></p>
<p>By default all Wordpress posts viewed as a single post are controlled by the particular theme&#8217;s &#8220;<em>single.php</em>&#8221; file.</p>
<p>Wordpress, by default is setup to use one template file (&#8220;<em>single.php</em>&#8220;) for every post.(But what if you wanted to display a different layout or different code dependent on the specific categories a post or filed into?</p>
<p>To do this with Wordpress; one needs to use a bit of PHP in the &#8220;<em>single.php</em>&#8221; file and create category specific files.</p>
<p><span id="more-32"></span></p>
<p>In the below example lets assume the following:</p>
<ul>
<li>Category <u>2</u> is my <em>Blog</em></li>
<li>Category <u>15</u> is a <em>Photography</em> section</li>
<li>Category <u>18</u> is a <em>Video</em> section</li>
</ul>
<p>I want to display a different layout according to the particular post&#8217;s category so I would edit &#8220;<em>single.php</em>&#8221; as follows:</p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="re0">$post</span> <span class="sy0">=</span> <span class="re0">$wp_query</span><span class="sy0">-&gt;</span><span class="me1">post</span><span class="sy0">;</span>
<span class="kw1">if</span> <span class="br0">&#40;</span> in_category<span class="br0">&#40;</span><span class="st_h">'2'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="kw1">include</span><span class="br0">&#40;</span>TEMPLATEPATH <span class="sy0">.</span> <span class="st_h">'/single-blog.php'</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span> 
<span class="kw1">elseif</span> <span class="br0">&#40;</span> in_category<span class="br0">&#40;</span><span class="st_h">'15'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="kw1">include</span><span class="br0">&#40;</span>TEMPLATEPATH <span class="sy0">.</span> <span class="st_h">'/single-photography.php'</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span> 
<span class="kw1">elseif</span> <span class="br0">&#40;</span> in_category<span class="br0">&#40;</span><span class="st_h">'18'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="kw1">include</span><span class="br0">&#40;</span>TEMPLATEPATH <span class="sy0">.</span> <span class="st_h">'/single-video.php'</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span> 
<span class="kw1">else</span> <span class="br0">&#123;</span>
<span class="kw1">include</span><span class="br0">&#40;</span>TEMPLATEPATH <span class="sy0">.</span> <span class="st_h">'/single-default.php'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="sy1">?&gt;</span></div>
</div>
</pre>
<p>Proceeding editing this, the referenced files must be created e.g. &#8220;<em>single-blog.php</em>&#8220;, &#8220;<em>single-photography.php</em>&#8221; and &#8220;<em>single-video.php</em>&#8221; file referenced above. Also a &#8220;<em>single-default.php</em>&#8221; file should also be created so that any post that is not in any of the specified categories (15, 18 ir 2) will just use a default template file &#8211; &#8220;<em>single-default.php</em>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/tricks/different-single-post-pages-in-wordpress.html/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Creating A Splash Page For Wordpress</title>
		<link>http://wordpresshero.com/hacks/creating-a-splash-page-for-wordpress.html/</link>
		<comments>http://wordpresshero.com/hacks/creating-a-splash-page-for-wordpress.html/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 21:49:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=30</guid>
		<description><![CDATA[
On a recent job, the client consistently demanded a splash page for their website. Despite my consistent groans and insistence that the implementation of a splash page on their website would instantly turn it, them and me to the dark side, I gave in.
I reluctantly implemented a quick solution using Wordpress. I used php to [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Futcha Splash" id="image29" src="http://www.alanwho.com/wp-content/uploads/2006/07/futcha-splash.jpg" /></p>
<p>On a recent job, the client consistently demanded a splash page for their website. Despite my consistent groans and insistence that the implementation of a splash page on their website would instantly turn it, them and me to the dark side, I gave in.</p>
<p>I reluctantly implemented a quick solution using Wordpress. I used php to check if the user was referred to the index page from within the site or from out with the site.</p>
<p><span id="more-30"></span></p>
<p>Usually splash pages use an &#8220;index.html&#8221; page in the website root with a link to a directory such as &#8220;<em>blog</em>&#8220;. But I  had installed <a href="http://www.wordpress.org">Wordpress</a> in the root. I could not be bothered moving the installation folder from the root to another folder to suit the splash page nonsense. So I used php with an if statement to check if the user was referred to the site from outside the domain or within and thus display content accordingly:</p>
<pre class="prettyprint">
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#40;</span><a href="http://www.php.net/strpos"><span class="kw3">strpos</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">'HTTP_REFERER'</span><span class="br0">&#93;</span><span class="sy0">,</span> get_bloginfo<span class="br0">&#40;</span><span class="st_h">'home'</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">===</span> <span class="kw4">false</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="sy0">!</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">'QUERY_STRING'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span>
<span class="sy1">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Splash Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;&lt;a href=&quot;http://www.yourwebsite.com&quot;&gt;Enter&lt;/a&gt;&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
<span class="kw2">&lt;?php</span> <span class="kw1">else</span> <span class="sy0">:</span> <span class="sy1">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Main Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Welcome to the main page&lt;/h1&gt;
&lt;h2&gt;By the way Alan is a total ledge!&lt;/h2&gt;
&lt;/body&gt;
&lt;/html&gt;</div>
</div>
</pre>
<p>In reference to the above code; all that is before the else statement i.e. the following code:</p>
<pre class="prettyprint">
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>html<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>head<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>title<span class="sy0">&gt;</span>Splash Page<span class="sy0">&lt;/</span>title<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>head<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>body<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>h1<span class="sy0">&gt;&lt;</span>a href<span class="sy0">=</span><span class="st0">&quot;http://www.yourwebsite.com&quot;</span><span class="sy0">&gt;</span>Enter<span class="sy0">&lt;/</span>a<span class="sy0">&gt;&lt;/</span>h1<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>body<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>html<span class="sy0">&gt;</span></div>
</div>
</pre>
<p>Will be the output splash page. All that is after the else statement i.e. the following code:</p>
<pre class="prettyprint">
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>html<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>head<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>title<span class="sy0">&gt;</span>Main Page<span class="sy0">&lt;/</span>title<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>head<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>body<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>h1<span class="sy0">&gt;</span>Welcome to the main page<span class="sy0">&lt;/</span>h1<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>h2<span class="sy0">&gt;</span>By the way Alan is a total ledge<span class="sy0">!&lt;/</span>h2<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>body<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>html<span class="sy0">&gt;</span></div>
</div>
</pre>
<p>Will be output when the user clicks enter on the splash page.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/hacks/creating-a-splash-page-for-wordpress.html/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Separate Wordpress Category Feeds</title>
		<link>http://wordpresshero.com/tricks/separate-wordpress-category-feeds.html/</link>
		<comments>http://wordpresshero.com/tricks/separate-wordpress-category-feeds.html/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 21:46:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=28</guid>
		<description><![CDATA[‘Wordpress’ is renowned for allowing a generous selection of various feeds, whether it be ‘RSS’ or ‘ATOM’ or others, but it only comes with one basic feed option has default. Wouldn’t it be nice to be able to have a separate feed for separate categories?

At the start of this brief article I stated that ‘Wordpress’, [...]]]></description>
			<content:encoded><![CDATA[<p>‘Wordpress’ is renowned for allowing a generous selection of various feeds, whether it be <em>‘RSS’</em> or <em>‘ATOM’</em> or others, but it only comes with one basic feed option has default. Wouldn’t it be nice to be able to have a separate feed for separate categories?</p>
<p><span id="more-28"></span></p>
<p>At the start of this brief article I stated that ‘Wordpress’, “only comes with one basic feed option as default”, this is only half of the reality.</p>
<p>Wordpress is actually equipped to separate various categories into associated feeds, but such a function is disabled with the default install.</p>
<p>In order to access the feeds for categories, place the following one line of code anywhere on your site, the ’sidebar’ would be most fantastic: </p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span> wp_list_cats<span class="br0">&#40;</span>’sort_column<span class="sy0">=</span>name<span class="sy0">&amp;</span>optioncount<span class="sy0">=</span>1<span class="sy0">&amp;</span>feed<span class="sy0">=</span>RSS’<span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</div>
</pre>
<p>After adding the above code, a list of categories will be rendered with dedicated RSS links, so that you can reference them elsewhere if you so wished.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/tricks/separate-wordpress-category-feeds.html/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Category Images Hack</title>
		<link>http://wordpresshero.com/hacks/category-images-hack.html/</link>
		<comments>http://wordpresshero.com/hacks/category-images-hack.html/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 21:44:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=26</guid>
		<description><![CDATA[This hack makes Wordpress display a category image next to posts.
Every category needs to have an *.png image named in accordance to the &#8220;nice name&#8221; of the category (if the category is called &#8220;Web Development&#8221;, the nice name would be &#8220;web-development&#8221; so the category image should be &#8220;web-development.png&#8221; and placed in the /wp-images folder in [...]]]></description>
			<content:encoded><![CDATA[<p>This hack makes Wordpress display a category image next to posts.</p>
<p>Every category needs to have an *.png image named in accordance to the &#8220;nice name&#8221; of the category (if the category is called &#8220;Web Development&#8221;, the nice name would be &#8220;web-development&#8221; so the category image should be &#8220;web-development.png&#8221; and placed in the /wp-images folder in the root of a Wordpress blog).</p>
<p>A &#8220;my-hacks.php&#8221; file must exist on the server of a Wordpress installation. If one does not exist create one. Also, ensure that the <em>&#8220;Use legacy my-hacks.php file support&#8221;</em> checkbox is checked in Options > Miscellaneous in the admin area of wordpress.</p>
<p><span id="more-26"></span></p>
<p>Place the following code into a &#8220;my-hacks.php&#8221; file in the root of your Wordpress blog. </p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">function</span> category_images<span class="br0">&#40;</span><span class="re0">$seperator</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">,</span> <span class="re0">$image_type</span> <span class="sy0">=</span> <span class="st_h">'png'</span><span class="sy0">,</span> <span class="re0">$image_directory</span> <span class="sy0">=</span> <span class="st_h">'/wp-images/'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="re0">$categories</span> <span class="sy0">=</span> get_the_category<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$image_directory</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_replace"><span class="kw3">preg_replace</span></a><span class="br0">&#40;</span><span class="st_h">'|/+$|'</span><span class="sy0">,</span> <span class="st_h">''</span><span class="sy0">,</span> <span class="re0">$image_directory</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="st_h">''</span> <span class="sy0">==</span> <span class="re0">$seperator</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st_h">'&lt;span&gt;'</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$categories</span> <span class="kw1">as</span> <span class="re0">$category</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">cat_name</span> <span class="sy0">=</span> <a href="http://www.php.net/stripslashes"><span class="kw3">stripslashes</span></a><span class="br0">&#40;</span><span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">cat_name</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;&lt;a href='&quot;</span> <span class="sy0">.</span> get_category_link<span class="br0">&#40;</span>0<span class="sy0">,</span> <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">category_id</span><span class="sy0">,</span> <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">category_nicename</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st0">&quot;' title='View all posts in <span class="es4">$category-&gt;cat_name</span>'&gt;&lt;img src='<span class="es4">$image_directory</span>/<span class="es4">$category-&gt;category_nicename</span>.<span class="es4">$image_type</span>' alt='<span class="es4">$category-&gt;cat_name</span>' /&gt;&lt;/a&gt;&quot;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;<span class="es1">\n</span>&lt;/span&gt;&quot;</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$i</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$categories</span> <span class="kw1">as</span> <span class="re0">$category</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">cat_name</span> <span class="sy0">=</span> <a href="http://www.php.net/stripslashes"><span class="kw3">stripslashes</span></a><span class="br0">&#40;</span><span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">cat_name</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>0 <span class="sy0">&lt;</span> <span class="re0">$i</span><span class="br0">&#41;</span> <span class="kw1">echo</span> <span class="re0">$seperator</span> <span class="sy0">.</span> <span class="st_h">' '</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;&lt;a href='&quot;</span> <span class="sy0">.</span> get_category_link<span class="br0">&#40;</span>0<span class="sy0">,</span> <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">category_id</span><span class="sy0">,</span> <span class="re0">$category</span><span class="sy0">-&gt;</span><span class="me1">category_nicename</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st0">&quot;' title='View all posts in <span class="es4">$category-&gt;cat_name</span>'&gt;&lt;img src='<span class="es4">$image_directory</span>/<span class="es4">$category-&gt;category_nicename</span>.<span class="es4">$image_type</span>' alt='<span class="es4">$category-&gt;cat_name</span>' /&gt;&lt;/a&gt;&quot;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">++</span><span class="re0">$i</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
<span class="br0">&#125;</span></div>
</div>
</pre>
<p>To display category images place the following function in your loop:</p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span> 
category_images<span class="br0">&#40;</span><span class="st_h">' '</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp;<span class="sy1">?&gt;</span></div>
</div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/hacks/category-images-hack.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Include Preset Text In Wordpress Posts</title>
		<link>http://wordpresshero.com/hacks/include-preset-text-in-wordpress-posts.html/</link>
		<comments>http://wordpresshero.com/hacks/include-preset-text-in-wordpress-posts.html/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 00:26:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=18</guid>
		<description><![CDATA[Pre-Written Text On The Wordpress &#8216;Write&#8217; Page
I wanted to have some text at the bottom of ehttp://wordpresshero.com/wp-admin/post.php?action=edit&#038;post=18&#038;message=4
WordpressHero › Edit — WordPressvery page and thus have it prewritten in the &#8216;Write&#8216; section of my admin section of my Wordpress blod. I did not want to have to go through the rigmoral of entering the same text [...]]]></description>
			<content:encoded><![CDATA[<h3>Pre-Written Text On The Wordpress &#8216;Write&#8217; Page</h3>
<p>I wanted to have some text at the bottom of ehttp://wordpresshero.com/wp-admin/post.php?action=edit&#038;post=18&#038;message=4<br />
WordpressHero › Edit — WordPressvery page and thus have it prewritten in the &#8216;<em>Write</em>&#8216; section of my admin section of my Wordpress blod. I did not want to have to go through the rigmoral of entering the same text everytime that I wanted to write a new post. I asked myself:</p>
<h3>How could I do this?</h3>
<p><span id="more-18"></span></p>
<h4><strong>Step 1</strong>: Editing the &#8216;<em>wp-admin/edit-form-advanced.php</em>&#8216; file.</h4>
<p>The file that needs to be edited is &#8216;<em>edit-form-advanced.php</em>&#8216; in the &#8216;<em>wp-admin</em>&#8216; folder. The line in question is <strong>100</strong>. I looked for the following portion of code on <strong>line 100</strong> of the &#8216;<em>edit-form-advanced.php</em>&#8216; file:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span> <span class="kw1">echo</span> <span class="re0">$content</span> <span class="sy1">?&gt;</span></div>
</div>
<p>For the sake of this example, the text, I want to have pre-written in the &#8216;Post&#8217; field in the &#8216;Write&#8217; page is &#8220;<strong>I AM AMAZING!</strong>&#8220;. In order to achieve my objective I simply alter the above code to the following:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span> <span class="kw1">echo</span> <span class="re0">$content</span> <span class="sy1">?&gt;</span><br />
I AM AMAZING!</div>
</div>
<h4><strong>Step 2</strong>: Save and upload.</h4>
<p>I then saved my changes and uploaded the changed &#8216;<em>edit-form-advanced.php</em>&#8216; file to my webserver in the &#8216;<em>wp-admin</em>&#8216; folder, and perfection is mine!</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/hacks/include-preset-text-in-wordpress-posts.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Show Only 1 Wordpress Category In &#8216;index.php&#8217;</title>
		<link>http://wordpresshero.com/hacks/show-only-1-wordpress-category-in-indexphp.html/</link>
		<comments>http://wordpresshero.com/hacks/show-only-1-wordpress-category-in-indexphp.html/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 00:10:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://wordpresshero.com/?p=24</guid>
		<description><![CDATA[
I wanted to just show my ‘website news’ category in the root of my Wordpress installation. But by default index.php shows the latest posts from all categories, this was not what I wanted. So how could I get what I want?

Step 1
I take a look in index.php. It displays:


&#60;?php
/* Short and sweet */
define&#40;&#34;WP_USE_THEMES&#34;, true&#41;;
require&#40;&#34;./wp-blog-header.php&#34;&#41;;
?&#62;


Step 2
After [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.alanwho.com/wp-admin/images/wordpress-logo.png" alt="Wordpress" /></p>
<p>I wanted to just show my ‘website news’ category in the root of my Wordpress installation. But by default index.php shows the latest posts from all categories, this was not what I wanted. So how could I get what I want?</p>
<p><span id="more-24"></span></p>
<h4>Step 1</h4>
<p>I take a look in index.php. It displays:</p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="coMULTI">/* Short and sweet */</span>
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&quot;WP_USE_THEMES&quot;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw1">require</span><span class="br0">&#40;</span><span class="st0">&quot;./wp-blog-header.php&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</span></div>
</div>
</pre>
<h4>Step 2</h4>
<p>After looking at this code I could see, clearly, there was no statement to restrict what category to show, which was what I wanted. So I checked in the Administration>Categories section in the Administration part of my site to find out the category ID of the category I wanted to just show on my index.php in my Wordpress installation root, the category ID was ‘2?. I changed index.php to the following and uploaded it to my webserver:</p>
<pre>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="re0">$blog</span> <span class="sy0">=</span> <span class="nu0">1</span><span class="sy0">;</span>
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$cat</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="re0">$cat</span> <span class="sy0">=</span> <span class="st0">&quot;2&quot;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="coMULTI">/* Don't remove this line. */</span>
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&quot;WP_USE_THEMES&quot;</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw1">require</span><span class="br0">&#40;</span><span class="st0">&quot;./wp-blog-header.php&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</span></div>
</div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpresshero.com/hacks/show-only-1-wordpress-category-in-indexphp.html/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

