<?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>More Than Scratch The Surface &#187; WordPress</title>
	<atom:link href="http://www.scratch99.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scratch99.com</link>
	<description>A Journey In Web Development</description>
	<lastBuildDate>Sat, 31 Jul 2010 04:51:20 +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>Practical Theme Support For WordPress 3.0 Menus</title>
		<link>http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/</link>
		<comments>http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 06:50:51 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[menus]]></category>
		<category><![CDATA[theme development]]></category>
		<category><![CDATA[WordPress 3.0]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=277</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/.I&#8217;ve read quite a few articles on theme support for the new Menu functionality introduced in WordPress 3.0. However, these have all been theoretical rather than practical. I wanted a real life, working example, including support for users on older versions of WordPress. In the [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/">http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/</a>.<br /><p>I&#8217;ve read quite a few articles on theme support for the new Menu functionality introduced in WordPress 3.0. However, <strong>these have all been theoretical rather than practical</strong>. I wanted a real life, working example, including support for users on older versions of WordPress. In the end, I wrote it myself.</p>
<div class="csstextbox1"><strong>WordPress Theme developers, listen up! When updating your themes to work with the new menu functionality, you need to make sure that it still works with older versions of WordPress.</strong></div>
</p>
<h2>Scope</h2>
<p>I&#8217;m not going to delve into all the different options you can use when adding support for menus. There are enough articles out there that cover this in depth: I highly recommend you read Justin Tadlock&#8217;s excellent <a href="http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus">Goodbye, headaches. Hello, menus!</a>. </p>
<p>Instead, I&#8217;m going to focus on the things missing from most articles, such as adding support for users on older versions and including support for static pages in the fallback menu. <strong>If you write themes that are used by other people, you need to include these</strong>.</p>
<h2>Functions.php</h2>
<p>First, this is the code to add to the functions.php file. I&#8217;ll explain it below.</p>
<pre class="brush: php;">
// add menu support and fallback menu if menu doesn't exist
add_action('init', 'sjc_register_menu');
function sjc_register_menu() {
	if (function_exists('register_nav_menu')) {
		register_nav_menu('sjc-main-menu', __('Main Menu'));
	}
}
function sjc_default_menu() {
	echo '&lt;ul&gt;';
	if ('page' != get_option('show_on_front')) {
		echo '&lt;li&gt;&lt;a href=&quot;'. get_option('home') . '/&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;';
	}
	wp_list_pages('title_li=');
	echo '&lt;/ul&gt;';
}
</pre>
<h3>Check If register_nav_menu Exists Before Calling It</h3>
<p>On line 2, we add an action to call a function (from line 3 to 7). The purpose of this function is to register the menu via the <strong>register_nav_menu</strong> function. </p>
<p>Most tutorials out there focus on how to use register_nav_menu (line 5). Fair enough, it&#8217;s new and we&#8217;re all interested in how to use it. However, I want you to notice line 4: </p>
<p class="codebox"><code>if (function_exists(&#039;register_nav_menu&#039;))<br />
</code></p>
<p>Surprisingly, most tutorials leave this out. No problem if your theme will only ever run on WordPress 3.0. However, if you have users on an older version of WordPress, <strong>your theme will crash and burn if you leave this out</strong>. Visitors will be greeted with the following error:</p>
<p class="codebox"><code>Fatal error: Call to undefined function register_nav_menu() &#46;..</code></p>
<p>Not cool.</p>
<h3>The Fall Back Menu Catering For Static Pages</h3>
<p>Lines 8 to 15 contain a function that provides a fall back menu that is used if the user has not added a menu via the new interface. The code for the fall back menu is pretty standard stuff. I&#8217;m sure someone will point out that I could use <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu</a>, but we&#8217;ll call the fall back menu directly for older versions of WordPress (see below) and wp_nav_menu only exists in 3.0 and above.</p>
<p>It&#8217;s worth noting the IF statement on line 10, wrapping the Home link. This says to only create the Home link IF the site is NOT using a static home page. If it is, then the Home link will not be created. Why? Without this, <strong>the Home page option will appear twice</strong> in the menu (if users have a static home page). </p>
<p>There are <a href="http://www.wplover.com/1210/bulletproof-wordpress-pages-based-navigation">other ways of dealing with this</a>, but my way seems simplest to me.</p>
<div class="csstextbox1">Note: To get the static home page to appear first, the user can adjust the Page Order of the static page in the Edit screen. The easiest way to ensure that it appears before other pages, apart from editing the Page Order of all the other pages, is to simply set it to -1.</div>
<h2>Header.php</h2>
<p>Moving on to header.php, we add the following code where we want the menu to appear:</p>
<pre class="brush: php;">
&lt;div id=&quot;nav&quot;&gt;
	&lt;?php
	if (function_exists('wp_nav_menu')) {
		wp_nav_menu(array('theme_location' =&gt; 'sjc-main-menu', 'fallback_cb' =&gt; 'sjc_default_menu'));
	}
	else {
		sjc_default_menu();
	}
	?&gt;
&lt;/div&gt;
</pre>
<h3>Call The Fallback Menu Function Directly For Pre WordPress 3.0</h3>
<p>The menu is called via the wp_nav_menu function (see line 4 above). This function is what the other articles all focus on. Once again, fair enough, this is a new function that can give us access to the cool new menus. But note the IF statement in line 3:</p>
<p class="codebox"><code>if (function_exists(&#039;wp_nav_menu&#039;))</code></p>
<p>Leave this out and anyone using your theme on versions of WordPress older than 3.0 is going to be <strong>serving the following up to their visitors</strong>:</p>
<p class="codebox"><code>Fatal error: Call to undefined function wp_nav_menu()</code></p>
<p>Checking that the wp_nav_menu exists is obviously essential, unless you are certain that your theme will only ever run on WordPress 3.0 or above. </p>
<p>But what do we do if wp_nav_menu doesn&#8217;t exist (ie the user is on an older version of WordPress)? Should we serve up the original code that we originally used to create the menu pre WordPress 3.0? </p>
<p>Well, we&#8217;ve already moved our old code into the fall back menu function. There&#8217;s nothing to stop us from calling the fall back menu function directly  (line 7) assuming it doesn&#8217;t use wp_nav_menu. Simple! And good reuse of code.</p>
<div class="csstextbox1">As you can see the menu is wrapped in a div element with an id of &#8220;nav&#8221;. This is entirely optional, depending on how you choose to implement your CSS. An unordered list will be created by the PHP code. You may want to add a class directly to the ul element, instead of including the div. You can do this using the menu_class parameter in line 4 above.</div>
<h2>Final Thoughts</h2>
<p>WordPress Theme developers, what have you done to ensure menu support for your users on older versions of WordPress? Is your approach different from mine? Can you see a better way of doing this? </p>
<p>I&#8217;d love to hear from you in the comments.</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2010/06/practical-theme-support-for-wordpress-3-0-menus/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Solution To The Lack Of WordPress Beta Testing</title>
		<link>http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/</link>
		<comments>http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 03:23:24 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=250</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/.While catching up on some old podcasts, specifically Episode 82 of WordPress Weekly, I came across a discussion about WordPress beta testing. The discussion centers around the problem of bugs not being caught during beta testing because there just aren&#8217;t enough beta testers.
To me, the [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/">http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/</a>.<br /><p>While catching up on some old podcasts, specifically <a href="http://www.wptavern.com/wpweekly-episode-82-%E2%80%93-the-tinfoil-hat-brigade" target="_blank">Episode 82 of WordPress Weekly</a>, I came across a discussion about <a href="http://www.wordpress.org/" target="_blank">WordPress</a> beta testing. The discussion centers around the problem of <strong>bugs not being caught</strong> during beta testing because there just <strong>aren&#8217;t enough beta testers</strong>.</p>
<p>To me, the solution seems straightforward &#8211; but that may be because I worked in the software industry for 10 years and have experience in <strong>software release management</strong>, so I&#8217;ll take the long path and set the scene properly. </p>
<p>That makes it a long post, but stick with it &#8211; you need to read it all to fully understand my reasoning. First we need to consider the following question:</p>
<h2>Should You Upgrade WordPress Immediately After A Release?</h2>
<p>Short answer: Sometimes, but <strong>not always</strong>.</p>
<p>Over the last couple of years, there have been repeated calls for WordPress users to update their blogs immediately after a new version has been released. At times, the call to upgrade has almost become a frenzy. </p>
<p>I&#8217;ve taken this with a grain of salt and held to my belief that upgrading immediately isn&#8217;t always the correct choice. <strong>Sure, upgrade immediately if the release fixes a critical security issue</strong> &#8211; but most of the time it&#8217;s better to wait and see whether:</p>
<ul>
<li>there are any major bugs in the new version </li>
<li>your theme works with the new version </li>
<li>all of the plugins you&#8217;re using work with the new version </li>
</ul>
<p>I&#8217;ve developed this &#8216;hold back&#8217; approach while working in the software industry over the last 15 years or so &#8211; I&#8217;d contend that it&#8217;s &#8216;best practice&#8217;. <strong>Upgrading</strong> to a new version <strong>without testing</strong> the new version in your environment (including server, theme and plugins) <strong>is the sign of immature processes</strong>.</p>
<p>Some may argue that this approach is overkill for a simple blog, but there are many sites out there running WordPress that are a little more complicated. </p>
<p>Even simple blogs are often not that simple, especially as so many are now monetized. Ask yourself, will I lose money if WordPress doesn&#8217;t work after an upgrade? If the answer is yes, you should probably be testing new versions before upgrading.</p>
<div class="csstextbox1">Note: I&#8217;m a relatively sophisticated WordPress user and can judge the need to upgrade pretty well from the release notes. <strong>If the release notes don&#8217;t make much sense to you, it&#8217;s better to err on the side of caution and upgrade</strong>.</div>
<p>You&#8217;re probably asking how does this relate to beta testing? Well, in a couple of ways:</p>
<h3>1. Bugs In New Releases Mean Less People Will Upgrade</h3>
<p>Let&#8217;s leave aside the fact that I don&#8217;t personally subscribe to the &#8216;upgrade immediately&#8217; advice and assume that it&#8217;s a good thing (which it would be in the ideal world). </p>
<p>Bugs in new releases undermine this advice. After the recent <a href="http://wordpress.org/support/topic/343080" target="_blank">problem with scheduled posts</a>, introduced in the WordPress 2.9 release, there have been people questioning whether upgrading immediately was a good thing.</p>
<p>If beta testing was improved and caught more of these problems, then there&#8217;d be less of the &#8216;hold back&#8217; people out there and more people would follow the advice, in theory making WordPress more secure. There&#8217;d be:</p>
<ul>
<li>less people (such as <a href="http://scobleizer.com/2009/09/05/i-dont-feel-safe-with-wordpress-hackers-broke-in-and-took-things/" target="_blank">Robert Scoble</a>) complaining about WordPress security.</li>
<li>less need for Matt to <a href="http://wordpress.org/development/2009/09/keep-wordpress-secure/" target="_blank">write public responses</a> outlining why people should upgrade.</li>
<li>less complaints about bugs and the loss of functionality.</li>
</ul>
<p>There&#8217;ll always be bugs in software and there&#8217;ll always be people who complain &#8211; but more comprehensive beta testing would lead to less bugs, leading to less unhappy users, leading to more sites being updated immediately, leading to less hacking, leading to even less unhappy users.</p>
<p><strong>Better beta testing begets better security</strong>.</p>
<h3>2. Balance Between Upgrade Speed Vs Security</h3>
<p>Alternatively, if we don&#8217;t leave aside my beliefs, if we can moderate the <strong>unthinking update immediately</strong> advice, then we&#8217;re provided with a tremendous opportunity:</p>
<p>On a case by case basis, we can decide if an upgrade is in the &#8220;update immediately&#8221; category or in the &#8220;can wait for critical bugs to be fixed&#8221; category.</p>
<p>My solution, way down the bottom of this post, is going to propose delays to upgrades that are not for critical security issues, so that user experience less critical bugs. But more on that later.</p>
<h2>The Problem: A Lack Of Beta Testers</h2>
<p>The problem, which has been mentioned in various places including the podcast, is that although WordPress has a beta testing phase, <strong>there aren&#8217;t enough end users testing it</strong> to catch all the critical bugs. The software appears to runs fine during beta testing, but bugs rise to the surface when the release is rolled out to everyone. </p>
<p>First, some facts:</p>
<ul>
<li>Software is always going to have bugs </li>
<li>Beta testing will never find all the bugs </li>
</ul>
<p>There will always be some bugs that are only triggered when the software is run in an obscure environment or is used in a way that&#8217;s slightly different from how most people use it.</p>
<p>So it&#8217;s not about eliminating bugs, just about reducing the number of critical bugs that get through beta testing. The only way to do this is to get more people, using the software in different ways, on different server environments, to test the software.</p>
<p><strong>How do we get more people to test the software</strong>? The answer&#8217;s coming soon (honest).</p>
<h2>Software Release Management Anecdotes </h2>
<p>First, let me say that I worked in the software industry (for a <a href="http://www.softlinkint.com/" target="_blank">library management system</a> vendor) for 10 years. For quite a bit of that time, I was the person who authorised the release of software to clients and/or agents. </p>
<p>I could bore you with <strong>software release management</strong> anecdotes going back to 1994. Luckily for you, I came to my senses and edited them out! I&#8217;ll just say that making sure that major releases were properly tested and free of bugs was extremely important for the following reasons:</p>
<ul>
<li><strong>Loss of reputation, harming future sales</strong>: Upset users are significant in the relatively small library software marketplace. </li>
<li><strong>Direct financial loss</strong>: yes, it cost a significant amount of money to burn 5000 CDs back in 1994 (and then post them out). </li>
<li><strong>Lots of additional work</strong>: printing letters, packaging CDs and supporting users who were upgrading, etc. </li>
</ul>
<p>Obviously, WordPress operates in a very different environment from library software industry of old and many of these points are less of an issue: </p>
<p>If WordPress lose one user, or even ten thousand users, because of loss of reputation, <strong>they don&#8217;t actually lose any money in sales</strong> (actually there is no they!). If they have to release an upgrade, there are no costs for CDs and postage, people just download it. There&#8217;s no surge in the amount of support they need to provide, as support is crowd sourced.</p>
<p>Does that mean WordPress can afford to ignore this issue? </p>
<p>I say No &#8211; they should care about their reputation (and their users), even if there isn&#8217;t the same financial emphasis that there is in the closed source software industry. In fact, they should look to the closed source software industry and learn from it. <strong>Solutions to this very problem have been worked on and refined for decades</strong>. </p>
<p>In my particular case, we had several major incidents that led to us refining our <strong>testing and release processes</strong>. We ended up moving to a process that involved three phases of testing &#8211; I&#8217;ll outline these and relate them to WordPress in the next section. </p>
<h2>The Three Phases Of Testing</h2>
<h3>1. Developer Testing</h3>
<p>I&#8217;m sure this is done comprehensively by the WordPress developers. Ultimately, we employed a couple of full time testers, which Automattic could possibly consider funding. They may already have some testers (besides the Chief BBQ Taste Tester), although it&#8217;s not obvious from <a href="http://automattic.com/about/" target="_blank">their About page</a>. </p>
<div class="csstextbox1">I&#8217;m not going to explain the relationship between the WordPress project and Automattic here. This post is long enough. Let&#8217;s just say that the WordPress project itself doesn&#8217;t have any money (as I understand it). Automattic does have money and they have a record of employing people to work on the project.</div>
<p>But the problem isn&#8217;t here and full time testers would only have limited impact, so let&#8217;s keep moving.</p>
<h3>2. Beta Testing</h3>
<p>This is being done, but the problem is that <strong>not enough end users are involved</strong>. WordPress could look at ways to entice more users to join the beta testing program, but many of the methods that the closed source software industry use, such as offering discounts to beta testers, won&#8217;t work in the open source world.</p>
<p>One idea could be to build in a &quot;do you want to upgrade to the beta version (for the greater good)&quot; message into the automatic update function. When a beta version is released, everyone gets this message. </p>
<p>It would have to be very clear that it was a beta version and that there may be some problems and it would need Yes, No and Never Ask Me Again options, but it could work. Not many would choose to upgrade, but <strong>1% of 3 million is 30,000</strong>, which is a lot more than the number of current beta testers.</p>
<p>Once again, though, I don&#8217;t think the answer is here. It would be a significant improvement, but could cause <strong>a lot of negative publicity</strong>: there&#8217;d be too many people who&#8217;d choose it accidentally, then blame WordPress for upgrading them to beta software.</p>
<h3>3. Live User Testing / Staged Release</h3>
<p>So <strong>we come to the solution at last</strong> (I told you we would) and it&#8217;s not in the beta testing phase. </p>
<p>Instead, <strong>the answer lies in a staged roll-out to users</strong>: limiting new releases to a relatively small number of people until it&#8217;s proven that there are no major problems. </p>
<p>If any major problems are found, a decision can be made on whether they are serious enough to fix immediately, <strong>before making the software available to the rest of the users</strong>. Even if it&#8217;s decided not to fix the problems, users can be made aware of issues that may affect them before they upgrade. Even that small improvement would make a real difference to users.</p>
<div class="csstextbox1">WordPress.com is sometimes used for live user testing &#8211; and this is great for testing the pure functionality of new features &#8211; but it doesn&#8217;t test the software on the myriad of different server environments or with all the themes, plugins and advanced customisations that are out there. You need to test with live (self hosted) users.</div>
<p>The staged release approach been used for decades. I was using it 15 years ago. Google uses it today: they roll-out new features in Google Analytics or Google Adsense slowly. </p>
<h2>How Would A Staged Release Work?</h2>
<p>A staged roll-out of WordPress would work something like this:</p>
<ol>
<li>Once the beta testing phase is complete, the automatic upgrade notice would be sent out to say 100,000 people. </li>
<li>There would then be a period of say one week, where the feedback would be monitored and any critical bugs identified and investigated. </li>
<li>At the end of the period:
<ul>
<li>if no critical bugs have been identified, then the automatic upgrade would appear to everyone else. </li>
<li>If critical issues have been identified, a decision would be made on whether to proceed with the release or delay it until the problem is fixed. </li>
</ul>
</li>
</ol>
<p><strong>It goes without saying that urgent security releases would bypass this</strong>. </p>
<p>Now I&#8217;m not talking about physically denying the software to anyone, just manipulating who gets it through the automatic upgrade process. Anyone would still be able to visit wordpress.org and download the lastest version.</p>
<h2>How Would A Staged Release Be Achieved Technically?</h2>
<p>I&#8217;m not the best person to answer that, but I&#8217;d imagine it wouldn&#8217;t be too hard to do. It would require the automatic upgrade function to be modified: instead of WordPress installations asking &quot;is there a new version&quot;, they&#8217;d ask &quot;is there a new version and can I have it&quot;. </p>
<p>On the server side, it would check the download count and, when it reached the threshold, start saying no. You could make it complicated (checking whether it&#8217;s been downloaded from this IP address before), but it would be best to keep it simple.</p>
<p>There exists the potential that some users may be unhappy about either getting the new version before it&#8217;s been through live testing, or having to wait until after. The key here is that users are not getting the beta version, they&#8217;re getting the real version that&#8217;s been through beta testing, just as they would now. It&#8217;s just that it&#8217;s being rolled out slowly to further protect users. </p>
<p><strong>This would need to be well communicated</strong>. </p>
<p>Of course, <strong>it could be made it opt-in</strong>. The first 100,000 users could be shown the message: &quot;WordPress 3.1 is available! Update or Wait&quot;. If they choose Wait, it won&#8217;t ask them again until the live release testing is complete. The rest of the users would be shown: &quot;WordPress 3.1 is available, but we recommend you wait for moment. Wait or Upgrade anyway&quot;.</p>
<h2>Final Thoughts</h2>
<p>So the solution to the beta testing problem isn&#8217;t actually within the actual beta testing phase. It&#8217;s just to roll out the upgrades slowly, giving time for critical bugs to be caught before they affect too many people. <strong>This would protect the majority of users from any serious bugs</strong>.</p>
<p>Personally, I have doubts that this would ever be adopted: I think it would be seen as too complicated. But really, it wouldn&#8217;t be that hard to do and would make life better for the vast majority.</p>
<p><strong>What do you think</strong>? Am I crazy? Do you disagree with me? Do closed source practices have no place in the open source world? Do you have a better idea? Let me know!</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2010/02/the-solution-to-the-lack-of-wordpress-beta-testing/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Advanced WordPress Admin Tip: Posts By Category</title>
		<link>http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/</link>
		<comments>http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 13:51:06 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=240</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/.Go to Posts -&#62; Edit in the WordPress Admin area and you&#8217;ll see a list of all the posts you have. There is a dropdown list called View all categories, which allows you to select a single category to view posts from. But&#8230;
What if you [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/">http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/</a>.<br /><p>Go to Posts -&gt; Edit in the WordPress Admin area and you&#8217;ll see a list of all the posts you have. There is a dropdown list called View all categories, which allows you to select a single category to view posts from. But&#8230;</p>
<p>What if you want to <strong>view posts from more than one category</strong>, or better yet, want to <strong>exclude posts from certain categories</strong>? Can&#8217;t do it right? Well not through the WordPress interface, but you can do it through URL parameters.</p>
<h2>Finding Out Your Category Numbers</h2>
<p>To make this work, you&#8217;ll need to know the category numbers for your categories. You can find these through either of the following two methods:</p>
<ol>
<li>Go to Posts -&gt; Category screen and hold your mouse over the category in question. In your browser&#8217;s status bar you will see a URL which ends in ID=xx (xx is the number of the category). </li>
</ol>
<p>OR</p>
<ol start="2">
<li>While still in Posts -&gt; Edit, select the category you want in the dropdown list and click Filter. You&#8217;ll be taken to a page showing only posts from that category. In the browser&#8217;s address bar you&#8217;ll see that the URL contains cat=xx (xx is the number of the category). </li>
</ol>
<p>The first method is quicker if you want to look up multiple category numbers (you may want to write them down). The second method is better if you&#8217;re just after one or two category numbers &#8211; you&#8217;ll need to do this step anyway.</p>
<h2>First Step</h2>
<p>By default, the Posts -&gt; Edit screen has a URL that ends in wp-admin/edit.php with no parameters, eg:</p>
<p class="codebox">http://www.scratch99.com/wp-admin/edit.php</p>
<p>Rather than typing all the parameters, it makes sense to start with a URL that includes them. </p>
<p>If you haven&#8217;t already, select one of the categories you want to include / exclude in the dropdown list and click Filter. You&#8217;ll be taken to a page showing only posts from that category, but you will now have a URL that looks like this:</p>
<p class="codebox">http://www.scratch99.com/wp-admin/edit.php?s&amp;mode=list&amp;action=-1&amp;m=0&amp;cat=92&amp;action2=-1</p>
<p>We&#8217;re going to be changing the cat=xx part of the URL.</p>
<div class="csstextbox1">Note: Don&#8217;t bother trying to use the URLs in this post. My <a href="http://www.scratch99.com/2008/10/password-protecting-the-wp-admin-folder/">wp-admin section is password protected</a>, so all you&#8217;ll get is the password prompt.</div>
<h2>Displaying Posts From More Than One Category</h2>
<p>Perhaps I want to display posts from more than one category &#8211; in my case, I may want to see all the posts from my WordPress and Web Development categories, but not from the rest of my categories (too much noise).</p>
<p>Easy. Simply edit the URL and change the cat=xx to cat=xx,xx (where xx is the category numbers that you want). In my case, I change the URL to the following (note the cat=4,65):</p>
<p class="codebox">http://www.scratch99.com/wp-admin/edit.php?s&amp;mode=list&amp;action=-1&amp;m=0&amp;cat=4,65&amp;action2=-1</p>
<p>Want posts from three categories? That&#8217;s right: </p>
<p class="codebox">cat=xx,xx,xx</p>
<p>You&#8217;ve got it now!</p>
<h2>Excluding Posts From Certain Categories</h2>
<p>It&#8217;s also possible to exclude posts from certain categories from appearing in the Posts -> Edit screen.</p>
<p>Why would I want to exclude posts from certain categories? Actually, that&#8217;s how I started looking into this issue. I haven&#8217;t been posting much recently and, as a result, my weekly automatic lifestream digest posts pretty much filled up the screen: </p>
<p><img src="http://www.scratch99.com/wp-content/uploads/2010/01/edit-posts-1.png" alt="too many noisy entries in Edit Posts list" width="500" height="627" /></p>
<p>I was having trouble seeing my real posts! </p>
<p>Thankfully it&#8217;s easy to <strong>exclude the category that these posts are in</strong>. Simply edit the URL and change the cat=xx to cat=-xx (where xx is the category number you want). In my case, I change the URL to the following (note the minus sign, eg: cat=-92):</p>
<p class="codebox">http://www.scratch99.com/wp-admin/edit.php?s&amp;mode=list&amp;action=-1&amp;m=0&amp;cat=-92&amp;action2=-1</p>
<p>The result:</p>
<p><img src="http://www.scratch99.com/wp-content/uploads/2010/01/edit-posts-2.png" alt="A much better list with unnecessary posts removed" width="500" height="155" /></p>
<p>Want to exclude posts from more than one category? That&#8217;s right: </p>
<p class="codebox">cat=-xx,-xx,-xx</p>
<div class="csstextbox1">Note: I follow the rule of having one category per post. I&#8217;m not quite sure what will happen if your posts have more than one category. Will they show up if you exclude one of the categories that they&#8217;re in? Probably, because they are also in a category you are including, but I don&#8217;t know for sure.</div>
<h2>Final Thoughts</h2>
<p>That&#8217;s all &#8211; it&#8217;s a fairly long post for a fairly simple tip. It&#8217;s probably not something that will be needed often, but in some circumstances it&#8217;s very useful to have <strong>greater control over which posts appear on the Edit Posts screen</strong>.</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2010/01/advanced-wordpress-admin-tip-posts-by-category/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>2009 On More Than Scratch The Surface</title>
		<link>http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/</link>
		<comments>http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 06:54:37 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[make money online]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=239</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/.Happy New Year to all! A year ago, after looking at my Google Analytics stats for the year, I wrote a post reviewing 2008. I figure I may as well do it again for 2009 and also take the opportunity to explain the direction of [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/">http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/</a>.<br /><p>Happy New Year to all! A year ago, after looking at my Google Analytics stats for the year, I wrote a <a href="http://www.scratch99.com/2009/01/2008-on-more-than-scratch-the-surface/">post reviewing 2008</a>. I figure I may as well do it again for 2009 and also take the opportunity to explain the direction of this site.</p>
<h2>The Top Ten Visited Posts In 2009</h2>
<p>According to Google Analytics, the top ten visited posts in 2009 (with the home page and plugin pages stripped out) were:</p>
<ol>
<li><a href="http://www.scratch99.com/2008/03/creating-javascript-array-dynamically-from-php-array/">Creating A JavaScript Array Dynamically Via PHP</a> (2008)</li>
<li><a href="http://www.scratch99.com/2009/01/blogger-how-to-add-adsense-inside-single-posts-only/">Blogger – How To Add Adsense Inside Single Posts Only</a> (2009)</li>
<li><a href="http://www.scratch99.com/2008/09/avoid-smart-pricing-show-adsense-only-to-search-engine-visitors/">How To Display Ads Only To Search Visitors</a> (2008)</li>
<li><a href="http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/">Poll – Which WordPress Theme Framework To Use?</a> (2009)</li>
<li><a href="http://www.scratch99.com/2007/06/wordpress-simple-css-text-boxes-in-posts/">WordPress – Simple CSS Text Boxes In Posts</a> (2007)</li>
<li><a href="http://www.scratch99.com/2007/08/wordpress-most-viewed-sidebar-widget/">WordPress – Most Viewed – Sidebar Widget</a> (2007)</li>
<li><a href="http://www.scratch99.com/2007/06/wordpress-rounded-text-boxes-in-posts/">WordPress – Rounded Text Boxes in Posts</a> (2007) </li>
<li><a href="http://www.scratch99.com/2009/03/custom-page-template-external-css-file/">Custom Page Templates – Calling An External CSS File</a> (2009)</li>
<li><a href="http://www.scratch99.com/2008/09/setting-cookies-in-wordpress-trap-for-beginners/">Setting Cookies In WordPress – Trap For Beginners</a> (2008)</li>
<li><a href="http://www.scratch99.com/2008/01/avoid-adsense-smart-pricing-on-blogs/">How To Avoid Adsense Smart Pricing On Blogs</a> (2008)</li>
</ol>
<p>While I feel some of those posts deserve to be there, there are some that I don&#8217;t feel are particularly deserving. </p>
<p>Also, as you can see, there&#8217;s only 3 posts written in 2009 in that list. The others were written in 2008 (4 posts) or 2007 (3 posts). I guess that&#8217;s not too surprising as a lot of my traffic comes from search engines and old posts are just as likely to rank well as new ones. </p>
<p>It also doesn&#8217;t help that I only wrote 20 posts in 2009 (not counting automatic lifestream posts), but more on that later.</p>
<h2>My Top 5 Posts From 2009</h2>
<p>Last year, I included a list of the 10 posts that <strong>I thought were my best</strong> in 2008. If I were to do this again for 2009, I&#8217;d only go with 5 articles that I was particularly happy with. There are others which are okay, but don&#8217;t particularly stand out for me. </p>
<p>So, here are my top 5 posts written in 2009:</p>
<ol>
<li><a href="http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/">Subscribe To Comments &#038; Protected Wp-admin Folder</a></li>
<li><a href="http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/"></a><a href="http://www.scratch99.com/2009/01/blogger-how-to-add-adsense-inside-single-posts-only/">Blogger – How To Add Adsense Inside Single Posts Only</a></li>
<li><a href="http://www.scratch99.com/2009/01/make-money-online-smart-pricing-on-blogger/">Show Adsense To Search Visitors Only – On Blogger</a></li>
<li><a href="http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/">XAMMPLite Virtual Directory And WordPress Permalinks</a></li>
<li><a href="http://www.scratch99.com/2009/10/sharepoint-as-a-cms-microsoft-tech-ed-australia-2009/">Sharepoint As A CMS – Microsoft Tech.Ed Australia 2009</a></li>
</ol>
<h2>Other Interesting Stats From Google Analytics</h2>
<p>Google Analytics also provided some interesting statistics for 2009 on this site.</p>
<h3>Traffic</h3>
<p>The site had significantly more traffic in 2009 than in did in 2008. There were <strong>75,343 Visits</strong> and <strong>113,016 Pageviews</strong> in 2009, up from 46,488 Visits and 74,916 Pageviews in 2008.</p>
<p>That said, the first half of 2009 was the best: traffic tailed off slightly in the second half of 2009 (since I <a href="http://www.scratch99.com/2009/05/bye-bye-dofollow/">disabled my DoFollow plugin</a>).</p>
<p>It will be interesting to see what will happen in 2010. Unlike last year, I&#8217;m not particularly concerned about whether traffic will increase in 2010. </p>
<p>I now consider this site as an area for me to write about my <a href="http://www.scratch99.com/wordpress-plugins-by-stephen-cronin/">WordPress plugins</a> and my <a href="http://userscripts.org/users/37070">Greasemonkey scripts</a> &#8211; I no longer have any grand ambitions about creating a thriving blog.</p>
<h3>Browser Breakdown</h3>
<p>The vast majority of visitors were using Firefox. That isn’t surprising given the nature of this blog, as it appeals to web developers and bloggers, groups given to using FireFox. The full breakdown is as follows:</p>
<ol>
<li>Firefox – 67.62%</li>
<li>Internet Explorer – 17.65%</li>
<li>Chrome – 6.24%</li>
<li>Safari – 4.75%</li>
<li>Opera – 2.30%</li>
</ol>
<p>Of the Internet Explorer users, 20.66% were using IE6 (about 3.6% of all visitors). Too many! The numbers are roughly the same as last year, but with a slight drop for IE and a 5% increase for Chrome.</p>
<h3>Operating systems</h3>
<p>The major operating systems used by visitors was virtually the same as last year, being dominated by Windows. The full breakdown is as follows:</p>
<ol>
<li>Windows – 82.92% </li>
<li>Macintosh – 12.28% </li>
<li>Linux – 4.25%</li>
</ol>
<h3>Top 10 Screen Resolutions</h3>
<p>The screen resolution of visitors is always important to web developers. I’ve included the top 10 resolutions below.</p>
<ol>
<li>1024×768 – 21.23% </li>
<li>1280×800 – 19.57% </li>
<li>1280×1024 – 15.07% </li>
<li>1440×900 – 11.88% </li>
<li>1680×1050 – 11.06% </li>
<li>1920×1200 – 5.21% </li>
<li>1152×864 – 2.36% </li>
<li>800×600 – 1.76% </li>
<li>1366×768 – 1.50%</li>
<li>1280×768 – 1.46%</li>
</ol>
<p>Interesting things to note are:</p>
<ul>
<li>800×600 has actually moved up one place, despite me proclaiming last year that it had almost dropped off the list at last. It&#8217;s hanging in there grimly.</li>
<li>1024×768 is still the most popular, but it&#8217;s 5% lead in to 2009 has been reduced to just 2% in 2009. Will it hang on in 2010?</li>
</ul>
<h3>Top 10 Countries</h3>
<ol>
<li>US (by far)</li>
<li>India</li>
<li>UK (London was the top city)</li>
<li>Canada</li>
<li>Australia</li>
<li>Philippines (Hi RT)</li>
<li>Germany</li>
<li>Indonesia</li>
<li>France</li>
<li>Netherlands</li>
</ol>
<p>Not much change here.</p>
<h2>Report Card For 2009</h2>
<p>I didn&#8217;t meet many of my goals for 2009, as I changed my objectives during the course of the year. Here&#8217;s a brief rundown on how I did for each of my 2009 goals.</p>
<h3>Post More Often</h3>
<p>I published 52 posts in 2007, followed by 41 posts in 2008. One of my 2009 goals was to post more often.  I failed big time, only publishing 20 posts in 2009. As I said last year:</p>
<blockquote>
<p>It’s not for lack of ideas – I have <b>lots</b> of half written posts that I just need some time to finish off. I tend to spend more time working on my projects than writing about what I’m learning.</p>
</blockquote>
<p>That&#8217;s still true, but I&#8217;m more comfortable with it now. I&#8217;ll probably post more this year, but won&#8217;t sweat it if I don&#8217;t.</p>
<h3>Post On Topic</h3>
<p>Last year I wrote:</p>
<blockquote>
<p>It’s noticeable in my top 10 posts above that many are my Make Money Online posts. I’d like to keep posting on that topic as I learn more about it, but I want to post more often on my Web Development efforts (and WordPress of course).</p>
</blockquote>
<p>I didn&#8217;t post often in 2009, but I was probably more aligned with my core topics than in 2008.</p>
<h3>Update My Current Wordpress Plugins</h3>
<p>I had planned to overhaul my <a href="http://www.scratch99.com/wordpress-plugins-by-stephen-cronin/">my existing WordPress plugins</a> and move them into the official WordPress plugin directory. Didn&#8217;t happen. The new ones are going into the official directory, but the old ones haven&#8217;t been touched. Still on my list for 2010.</p>
<h3>Release Some New WordPress Plugins</h3>
<p>Last year I wrote:</p>
<blockquote>
<p>I started off by writing that I’d like to release another 4 WordPress plugins this year (I already have 4 half finished plugins that I want to finish off). However, thinking of my workload, I changed it first to 3 plugins, then to 2 plugins! So we’ll have to see how many I can actually get out.</p>
</blockquote>
<p>Spot on! I released 2 new plugins in 2009. I&#8217;m sure more will follow in 2010.</p>
<h3>Release A WordPress Theme </h3>
<p>I had been thinking that I&#8217;d release a WordPress theme in 2009. Didn&#8217;t happen. This is now far down on my priority list. I may release one in future if I create my own theme framework for my sites, but it&#8217;s not likely anytime soon.</p>
<h3>Release Some Greasemonkey Scripts</h3>
<p>I released a couple of Greasemonkey scripts in 2009 and plan to release more in future. Greasemonkey rocks! I write little scripts for it all the time, although I haven&#8217;t released many of them (yet).</p>
<h2>Changing Goals For 2010</h2>
<p>I don&#8217;t really have many goals for this site in 2010. As I mentioned above, I&#8217;d like to update my old WordPress plugins and move them into the official directory, release some new WordPress plugins and release some new Greasemonkey scripts, but that&#8217;s about it. </p>
<p>I have other projects, which I won&#8217;t mention here, that are more of a focus for me in 2010. This is just going to become the &#8216;portal&#8217; to the software I release, with the occasional post thrown in.</p>
<h2>Final Thoughts</h2>
<p>Well that’s a quick look at the year that was and the year that will be here at More Than Scratch The Surface. I hope all your endeavours for 2010 are successful! If you have any big plans for your blog, feel free to share in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2010/01/2009-on-more-than-scratch-the-surface/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WordPress Taking Out The What?</title>
		<link>http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/</link>
		<comments>http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 23:24:00 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=199</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/.After listening to recent episodes of the WordPress Weekly podcast (episodes 67 and 68), I was surprised to learn that in future versions of WordPress, the Delete link will be replaced with Trash. 
So what does Trash mean? After looking it up in the dictionary, [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/">http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/</a>.<br /><p>After listening to recent episodes of the WordPress Weekly podcast (episodes <a href="http://www.wptavern.com/wpweekly-episode-67-everywhere-you-look-theres-a-wordpress-book">67</a> and <a href="http://www.wptavern.com/wpweekly-episode-68-hey-i-didnt-change-my-password">68</a>), I was surprised to learn that in future versions of WordPress, <strong>the Delete link will be replaced with Trash</strong>. </p>
<p>So what does Trash mean? After looking it up in the dictionary, I find it means the same thing as rubbish (or garbage)! </p>
<p>Ahh, I see. Items will not actually be deleted in future, they&#8217;ll be sent to the &#8216;Trash can&#8217;. The WordPress team don&#8217;t want to use the term Delete, as it implies that the item will be deleted and can&#8217;t be recovered. This may cause confusion amongst users. </p>
<p>The WordPress team&#8217;s thinking is commendable and I&#8217;m glad that over the last year or so they&#8217;ve put a lot of effort into usability. I actually think Jane Wells&#8217; appointment is the best thing to happen to WordPress in a long time.</p>
<p>The only problem is that in this case, they are <strong>replacing a term that is used universally</strong> in the English speaking world, <strong>with a term that is North American centric</strong>: Trash is not commonly used in Australia or the UK.</p>
<p>This may cause confusion in it&#8217;s own right. It probably won&#8217;t, because we&#8217;ve all seen American movies and know what it means &#8211; I didn&#8217;t really need to look up trash in the dictionary! </p>
<p>Actually I&#8217;m not upset about it. I just felt like making a point. </p>
<p>That&#8217;s probably because at one time in the past, I was the International Product manager for a library software company and had to ensure it was localised properly for Australia, UK and the US. It was little things like this that we needed to be careful about &#8211; we didn&#8217;t want to alienate our customers. </p>
<p>Of course they were paying customers, which means you have to cater for them a little more than for users of open source software, who are getting a great product for free. But <strong>it would be better to find a term that is used by everyone</strong>.</p>
<p>For my part, I&#8217;d be happy with keeping the term Delete. I&#8217;ve been using Windows for 15 years or so and I&#8217;m quite comfortable with the action of Delete actually sending things to the Recycle Bin. But I&#8217;m sure I&#8217;ll adjust if I have to take out the Trash in future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/08/wordpress-taking-out-the-what/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Development (Beginner&#8217;s Guide)</title>
		<link>http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/</link>
		<comments>http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 03:36:49 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=185</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/.This is perhaps my most overdue post ever &#8211; a review of Vladimir Prelovac&#8217;s book, WordPress Plugin Development (Beginner&#8217;s Guide) [note: that's an affiliate link]. 
I&#8217;ve had other posts that I&#8217;ve promised to write that I&#8217;ve had trouble finding time to deliver. In this case [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/">http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/</a>.<br /><p>This is perhaps my most overdue post ever &#8211; a review of <a href="http://www.prelovac.com/vladimir/" target="_blank">Vladimir Prelovac</a>&#8217;s book, <a href="http://www.amazon.com/gp/product/1847193595?ie=UTF8&amp;tag=scratch99-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1847193595">WordPress Plugin Development (Beginner&#8217;s Guide)</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=scratch99-20&amp;l=as2&amp;o=1&amp;a=1847193595" width="1" border="0" /> [note: that's an affiliate link]. </p>
<p>I&#8217;ve had other posts that I&#8217;ve promised to write that I&#8217;ve had trouble finding time to deliver. In this case however, I actually accepted a review copy of the book, so I really should have written about it before now. </p>
<p>In my defence, we had a new addition to the family and we&#8217;ve been undergoing major changes at work, so I&#8217;ve been spread pretty thin.</p>
<p>Also, because I live in Australia, Packt Publishing could only send me the eBook version. In many ways, I prefer ebooks &#8211; no more leaving books behind when you change country! In this case however, having a physical book in front of me would have meant I&#8217;d have been more likely to pick it up.</p>
<p>Anyway, enough with the excuses and on to the review!</p>
<h2>Book Details</h2>
<ul>
<li>Title: WordPress Plugin Development: Beginner&#8217;s Guide</li>
<li>Author: Vladimir Prelovac</li>
<li>Publisher: Packt Publishing</li>
<li>Paperback: 278 pages [191mm x 235mm]</li>
<li>Release date: February 2009</li>
<li>ISBN: 1847193595</li>
<li>ISBN(13): 978-1-847193-59-9</li>
</ul>
<h2>Who The Book Is For</h2>
<p>I&#8217;ll just quote the book on this one:</p>
<blockquote>
<p>This book is for programmers working with WordPress, who want to develop custom plugins and to hack the code base. You need to be familiar with the basics of WordPress and PHP programming and believe that code is poetry; this book will handle the rest.</p>
</blockquote>
<p>That seems to be WordPress Plugin developers, WordPress Theme developers, those providing <a href="http://www.scratch99.com/services/">web development services</a> based on WordPress and maybe some power users wanting to push the boundaries a little. </p>
<p>If you don&#8217;t have any experience with PHP (or jQuery for that matter), you might just get by, but I&#8217;d advise you to at least read up on the basics before you jump into this book.</p>
<h2>What The Book Covers</h2>
<p>The book covers most of what you&#8217;ll need to get started writing WordPress plugins &#8211; the right way. The topics covered include (in no particular order):</p>
<ul>
<li>The basics of the WordPress plugin architecture and the API used to hook into the WordPress functionality and manipulate it. </li>
<li>Interacting with the WordPress database </li>
<li>The use of custom fields to store data. </li>
<li>Creating widgets (though not using the new WordPress 2.8 widget api) </li>
<li>How to use both jQuery and AJAX within a WordPress plugin </li>
<li>Working with third party APIs such as Flickr </li>
<li>WordPress Plugin security </li>
<li>User roles and permissions </li>
<li>Localising WordPress plugins (ie to support other languages) </li>
<li>Managing the plugin options. </li>
<li>Maintaining WordPress plugins (including adding them to the WordPress Plugin repository) </li>
</ul>
<p>In short it covers a LOT. As I said, everything you need to know to write WordPress plugins.</p>
<h2>The Positive</h2>
<p>I&#8217;ll be honest &#8211; I haven&#8217;t read the book from cover to cover. I have read the first 3 chapters in their entirety and have skimmed the rest of the book, digging into some areas a little more. However, I&#8217;ve seen enough to get a good feel for the book and to know that I like what&#8217;s in it.</p>
<p>The book&#8217;s tagline is &quot;Learn by doing: less theory, more results&quot;. It teaches by example, rather than pushing a whole lot of theory at you. </p>
<p>The book walks step by step through the development of 6 real life WordPress plugins, covering the various issues that arise for each plugin and how to resolve them. Using real life examples makes it much easier to understand the concepts that Vladimir is teaching.</p>
<p>In my opinion, Vladimir has done a great job of choosing plugins which allow him to demonstrate all the things he needs to, without having to contrive situations just to demonstrate something. He weaves all the complex information together, giving you a little bit at time but building on it and reinforcing it later.</p>
<p>The source code is available for download, allowing you to try it out yourself without typing it &#8211; although if you&#8217;re a beginner I&#8217;d recommend that you do the hard way and type it. You&#8217;re much more likely to remember things that way. The source code is also a great starting point for you to start experimenting on your own.</p>
<p>I learnt quite a few things from the book &#8211; mostly things I&#8217;d heard of before, but hadn&#8217;t gotten around to learning about &#8211; but the book laid them out in a simple straight forward way making it easy for me to quickly understand.</p>
<p>Perhaps the best feature of the book is that Vladimir follows &#8216;best practice&#8217; methods for creating WordPress plugins. Are you not quite sure about any of the following: </p>
<ul>
<li>using nonces to make plugins more secure (and other security issues) </li>
<li>using wp_enqueue_script to load scripts rather than just calling them directly </li>
<li>localizing your WordPress plugin so that it can easily be translated into other languages </li>
<li>using shortcodes to call plugin functionality directly from the post body </li>
</ul>
<p>This book will make it clear just how to use these features and so much more. Whatever Vladimir does in the book, he uses best practice methods. </p>
<p>This is great both for new plugin authors (who&#8217;ll learn to do things the right way) and for existing plugin authors (such as myself) who need a refresher on the best way to do things in WordPress. There are plenty of us out there who have written plugins that work, but which could be written better.</p>
<p>I&#8217;ve been planning to go back and update my plugins to take this into account. When I get around to doing so, I&#8217;ll be consulting this book again for a good overview of what I need to do (and why).</p>
<h2>The Negative</h2>
<p>There are very few negatives with the book. The content, by and large, is excellent. </p>
<p>I did notice a few spelling errors. That&#8217;s always possible with large books, but ideally the editor should have picked them up.</p>
<p>The only other thing I noticed is that the order (within each section) takes a little getting used to. Vladimir pushes through the example, then explains what happened afterwards. For me this approach is a little counter-intuitive. However, you get used to it and isn&#8217;t a big problem. In fact <a href="http://omninoggin.com/wordpress-posts/book-reviews/book-review-wordpress-plugin-development/" target="_blank">some even think that this is a strong point</a>:</p>
<blockquote>
<p>Each mini-tutorial (&#8221;Time for action&#8221;) section is followed by a &#8220;What just happened?&#8221; section that let&#8217;s you take a breather to understand what you just did and why you did it. I believe that this pause for explanation is the key reason why it is so easy to learn from this book.</p>
</blockquote>
<p>Other reviews have mentioned that the book is a little fast paced. Perhaps, but it didn&#8217;t worry me and of course you can work through the examples at your own pace.</p>
<h2>Question Marks</h2>
<p>I do have some concerns about this book &#8211; not to do with the content, which is excellent, but to do with the very concept of a book on WordPress plugin development.</p>
<h3>Out Of Date Content</h3>
<p>I didn&#8217;t put this in the Negatives section, but I easily could have. WordPress is being updated all the time at an astonishing rate. Can the book keep up with this? The widget api was been overhauled as part of WordPress 2.8, meaning that section of the book is out of date already.</p>
<p>Vladimir will be on top of such changes and I&#8217;m sure there will be revised editions of the book, but the nature of a book on WordPress is that it will be behind from almost the minute it&#8217;s published.</p>
<h3>Free Alternative Information</h3>
<p>All of the information contained in this book is available free of charge elsewhere online. </p>
<p>Sure it may not be available in one place and ordered in such a useful way, but there are volumes written on WordPress plugin development. I&#8217;ve always found that a combination of the <a href="http://codex.wordpress.org/" target="_blank">WordPress Codex</a>, Google and the source code have been enough to tell me everything I need to know. I probably wouldn&#8217;t have gone out and spent money on this book because I&#8217;m comfortable with finding information through these alternative sources.</p>
<p>That&#8217;s not to say that such a book doesn&#8217;t have a place: It would be very useful for someone starting out on WordPress development who wants all the information up front without having to go out and search for it. The way I see it, this book is not a necessity, but is a luxury that will save you time.</p>
<h3>Size Of Target Audience</h3>
<p>Lets face it &#8211; when you round up all the WordPress plugin authors, there&#8217;s not too many of us and many won&#8217;t buy such a book. </p>
<p>There are more WordPress theme developers out there and I suspect that they will be a big target audience for this book &#8211; many of them are looking to extend their WordPress skills and to build more plugin-like functionality into their themes. However, there are other books coming that may appeal to theme developers more, as they are less plugin specific.</p>
<p>Perhaps the key to the success of this book is the rapid growth in the use of WordPress by web development agencies to provide solutions to clients. Is it enough to sustain several books on the topic (particularly in light of the other concerns above)? Only time will tell. </p>
<h2>Conclusion</h2>
<p>WordPress Plugin Development: Beginner&#8217;s Guide is a very good book. It covers everything you need know about writing WordPress plugins and it teaches by example rather than by lecturing.</p>
<p>That said there are question marks about the book &#8211; most notably how quickly it will go out of date due to the pace of development of the WordPress core.</p>
<p>For me, it won&#8217;t replace the WordPress Codex and Google as my prime source of information, but it would be very handy to have on a shelf to turn to from time to time. It would also be an excellent starting point for those just getting started with WordPress related development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/07/wordpress-plugin-development-beginners-guide/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Subscribe To Comments &amp; Protected Wp-admin Folder</title>
		<link>http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/</link>
		<comments>http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 03:03:10 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/?p=180</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/.Earlier today I received an email from an irate commentator, accusing me of spamming him and threatening to report me. He was receiving emails from my blog, via the Subscribe To Comments plugin, but he thought couldn&#8217;t unsubscribe. The cause: my wp-admin folder is password [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/">http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/</a>.<br /><p>Earlier today I received an email from an irate commentator, accusing me of spamming him and threatening to report me. He was receiving emails from my blog, via the <a href="http://txfx.net/code/wordpress/subscribe-to-comments/" target="_blank">Subscribe To Comments</a> plugin, but he thought couldn&#8217;t unsubscribe. The cause: my <a href="http://www.scratch99.com/2008/10/password-protecting-the-wp-admin-folder/">wp-admin folder is password protected</a>.</p>
<p>As it happens, the commentator had successfully blocked notifications from my site. However, he thought he hadn&#8217;t because he received a username / password prompt when he clicked the Unsubscribe link in the email. </p>
<div class="csstextbox1">Note: This post only applies to people using <strong>Subscribe To Comments</strong> who have <strong>password protected the wp-admin folder</strong>, either&#160; by manually editing the .htaccess file in the wp-admin folder, using the CPanel Password Protect function, or using a WordPress plugin such as <a href="http://www.askapache.com/wordpress/htaccess-password-protect.html" target="_blank">Ask Apache Password Protect</a>.</div>
<h2>Cause &#8211; Subscribe To Comments Calling Wp-admin.css</h2>
<p>I wasn&#8217;t sure why this was happening. The URL used for the Unsubscribe link didn&#8217;t appear to be going to the wp-admin folder and I couldn&#8217;t see any reason why it would need to. I rolled my sleeves up and jumped into the Subscribe To Comments code. I quickly found the reason on line 951 (in version 2.1.2):</p>
<pre class="brush: css;">@import url( &amp;lt;?php echo get_settings('siteurl'); ?&amp;gt;/wp-admin/wp-admin.css );</pre>
<p>The plugin is calling a CSS file from the wp-admin folder, which invokes the password prompt. As the user doesn&#8217;t know the password, they will probably click Cancel and the CSS file will not be served. </p>
<p>This CSS file is only used to style the Unsubscribe page. It <strong>does not</strong> affect the functionality of the Unsubscribe / Block function. It will continue to run and <strong>will unsubscribe the user</strong>. The only negative outcome will be it won&#8217;t look quite as nice. Well, not the only negative outcome: </p>
<p><strong>The user will be confused as hell because of the password prompt</strong>.</p>
<h2>Solution &#8211; Excluding Wp-admin.css From Protection</h2>
<p>I had to resolve this issue. The easiest solution would have been to just hack the code of the Subscribe To Comments plugin and <strong>remove the call to the CSS file</strong>. However, if the plugin is ever updated, then it would have overwritten my hack and we&#8217;d be back where we started.</p>
<p>The sensible alternative seemed to be to <strong>exclude the wp-admin.css file from the password protection</strong>. A CSS file is highly unlikely to be used in any attack on my site. </p>
<p>There didn&#8217;t seem to be anyway to exclude the file via CPanel, but I knew there&#8217;d be a way to do it by editing.htaccess. I&#8217;m no .htaccess expert, so I did a search on the topic, finding the answer in Brett Batie&#8217;s <a href="http://brett.batie.com/software-development/password-protect-all-but-one-file-htaccess/" target="_blank">Password Protect All but One File</a> post. </p>
<p>That post tells you how to exclude a file in general terms, so here are the instructions for excluding wp-admin.css file.</p>
<div class="csstextbox1">Note: This assumes you know how to FTP into your host, download the file in question, edit it, and upload it again. Remember, you should <strong>always make a copy of the file</strong> first, so you can put it back if something goes wrong.</div>
<p>Go to the wp-admin folder (make sure it is the wp-admin folder) on your server and edit the .htaccess file. It will probably look something like:</p>
<pre class="brush: jscript;">
AuthType Basic
AuthName &quot;Authorised Only&quot;
require valid-user
AuthUserFile &quot;&lt;path-to-site-root&gt;/wp-admin/passwd&quot;
</pre>
<div class="csstextbox1">Note: I&#8217;ve replaced my server path with &lt;path-to-site-root&gt;. Yours should have the path to the root of the site on your host&#8217;s server.</div>
<p>Leaving the first 4 lines exactly the same, add the following 4 lines directly after them:</p>
<pre class="brush: jscript;">
&lt;Files &quot;wp-admin.css&quot;&gt;
  Allow from all
  Satisfy any
&lt;/Files&gt;
</pre>
<p>That&#8217;s telling Apache to allow access to wp-admin.css. The final .htaccess (in the wp-admin folder), should look something like:</p>
<pre class="brush: jscript;">
AuthType Basic
AuthName &quot;Authorised Only&quot;
require valid-user
AuthUserFile &quot;&lt;path-to-site-root&gt;/wp-admin/passwd&quot;

&lt;Files &quot;wp-admin.css&quot;&gt;
  Allow from all
  Satisfy any
&lt;/Files&gt;
</pre>
<p>Problem solved. My visitors can now unsubscribe again (though why would they want to!). I still have the hardened security provided by password protecting the wp-admin folder. I haven&#8217;t had to hack Subscribe To Comments, which would cause problems when the plugin is upgraded.</p>
<h2>Final Thoughts</h2>
<p>Mark Jaquith, if you read this, many thanks for a <strong>great plugin </strong>- but could you consider copying the wp-admin.css file into the plugin folder and calling it from there? I&#8217;m fine with you making this post redundant!</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/06/subscribe-to-comments-protected-wp-admin-folder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Page Templates &#8211; Calling An External CSS File</title>
		<link>http://www.scratch99.com/2009/03/custom-page-template-external-css-file/</link>
		<comments>http://www.scratch99.com/2009/03/custom-page-template-external-css-file/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 13:21:42 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[custom page templates]]></category>
		<category><![CDATA[wordpress themes]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/2009/03/custom-page-template-external-css-file/</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/03/custom-page-template-external-css-file/.Note: Not long after writing this post, I discovered that the best way to load external CSS files is by using the wp_enqueue_style function. Similarly, the best way to load JavaScript files is by using the wp_enqueue_script function. The method outlined below is not necessary [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/03/custom-page-template-external-css-file/">http://www.scratch99.com/2009/03/custom-page-template-external-css-file/</a>.<br /><p><strong>Note: Not long after writing this post, I discovered that the best way to load external CSS files is by using the <a target="_blank" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style">wp_enqueue_style</a> function. Similarly, the best way to load JavaScript files is by using the <a target="_blank" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a> function. The method outlined below is not necessary &#8211; although it may still be useful for other things to be added to the head section.</strong></p>
<p><strong>Custom page templates</strong> are a powerful feature of WordPress that can be used to make pages (not posts) do something different from normal. You can make them do pretty much anything. Obviously, this can <strong>greatly increase the flexibility of your site</strong>. </p>
<p>Amongst other things, I&#8217;ve used custom page templates to create a <a href="http://www.jobsinchina.com/flickr-picks-wall/" target="_blank">basic photo wall</a> and a dynamic <a href="http://www.jobsinchina.com/jobs-in-china/" target="_blank">listing of jobs in China</a>.</p>
<p>However, because of the way most WordPress themes are created, calling <strong>an external CSS file</strong> from a <strong>custom page template</strong> is not straightforward. Here, I explain the problem, look at the options and explain how to use &#8216;plugin functionality&#8217; to overcome the problem.</p>
<h2>Creating Custom Page Templates</h2>
<p>Much has been written about creating custom page templates, so I won&#8217;t cover it in detail here. Briefly, you need to do the following:</p>
<ol>
<li>Create a php file in your theme directory, containing the functionality you want (I normally start with an existing template and modify it). </li>
<li>Ensure there is a comment at the top of the file, so WordPress knows it&#8217;s a template. For example (and don&#8217;t forget to change the name):
<pre class="brush: php;">
&lt;?php
/*
Template Name: My Page
*/
?&gt;
</pre>
</li>
<li>In the Admin panel, edit the page you want to use the custom template with and set the Template field to the template you created. </li>
</ol>
<p>That&#8217;s it in a nutshell. For more detailed instructions, please see:</p>
<ul>
<li><a href="http://www.binarymoon.co.uk/2007/06/wordpress-tips-and-tricks-custom-templates/" target="_blank">WordPress tips and tricks &#8211; custom templates</a> by Binary Moon</li>
<li><a href="http://www.prelovac.com/vladimir/customize-your-themes-with-page-templates" target="_blank">How to use custom page template in WordPress themes</a> by Vladimir Prelovac</li>
</ul>
<h2>Calling An External CSS File</h2>
<p>There may be times when you want to <strong>include something in the head section</strong> of the HTML document. The most obvious example is a call to an external CSS file to provide <strong>custom styling</strong> for the page. </p>
<p>Adding the style information to the main CSS file would add unnecessary weight to every page / post, when it&#8217;s only needed on one page. Inline CSS should be avoided where possible. So the best solution is an external CSS file that is called only for that page (ie called by the custom page template).</p>
<div class="csstextbox1">This article focuses on calling an external CSS file, but it also applies to anything that you want to add to the head section of the HTML document, such as <strong>calling a JavaScript file or adding a meta tag</strong>, etc.</div>
<h2>The Problem With Adding Items To The HTML Head</h2>
<p>It sounds simple enough: I just call the CSS file from the custom page template, right? Right in theory, but in practice you can&#8217;t easily do this because of the way most WordPress themes are designed.</p>
<p>The external CSS file must be called from the head section of the HTML document. In most WordPress themes, the entire head section is contained in the header.php file. This is normally called from the custom page template using the get_header() function in the following manner: </p>
<pre class="brush: php;">
&lt;?php
/*
Template Name: My Page
*/
?&gt;
&lt;?php get_header(); ?&gt;
</pre>
<p>This calls header.php, which will probably have a variation on the following:</p>
<pre class="brush: php;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &lt;?php language_attributes(); ?&gt;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;&quot; /&gt;
&lt;title&gt;&lt;?php bloginfo('name'); ?&gt; &lt;?php if ( is_single() ) { ?&gt; » Blog Archive &lt;?php } ?&gt; &lt;?php wp_title(); ?&gt;&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php bloginfo('stylesheet_url'); ?&gt;&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;link rel=&quot;shortcut icon&quot; href=&quot;&lt;?php bloginfo('stylesheet_directory'); ?&gt;/images/favicon.ico&quot; /&gt;
&lt;link rel=&quot;pingback&quot; href=&quot;&lt;?php bloginfo('pingback_url'); ?&gt;&quot; /&gt;
&lt;?php wp_head(); ?&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;page&quot;&gt;
&lt;div id=&quot;header&quot;&gt;
	&lt;div id=&quot;headerimg&quot;&gt;
		&lt;h1&gt;&lt;a href=&quot;&lt;?php echo get_option('home'); ?&gt;/&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
		&lt;div class=&quot;description&quot;&gt;&lt;?php bloginfo('description'); ?&gt;&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;hr /&gt;
</pre>
<p>If you try to call the CSS file before the get_header() function, for example:</p>
<pre class="brush: php;">
&lt;?php
/*
Template Name: My Page
*/
?&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php bloginfo('stylesheet_directory'); ?&gt;/includes/mypage.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;?php get_header(); ?&gt;
</pre>
<p>then the additional code will appear BEFORE the code in header.php. In the case above, it will appear before the DOCTYPE line, which is obviously no good.</p>
<p>If you try to call the CSS file after the get_header() function, then the additional code will appear after the code in header.php. In the case above, it will appear after &lt;hr /&gt;, which is in the body of the HTML document and also no good.</p>
<p>There are several solutions to this problem.</p>
<h2>Rejected Solution 1 &#8211; Don&#8217;t Use Header.php</h2>
<p>One possible solution is to <strong>copy and paste the code from header.php</strong> into the custom template, instead of calling it via get_header(). You can then easily edit the code to add the call to the external file. Great!</p>
<p>The problem is that if you ever change header.php, <strong>you&#8217;ll have to remember to come back and change the equivalent code</strong> in the custom page template. That&#8217;s messy (and the chances are you&#8217;ll forget).</p>
<h2>Rejected Solution 2 &#8211; Edit Header.php</h2>
<p>Another possible solution is to edit header.php and <strong>use a conditional statement to only include the CSS file on the page in question</strong>. For example, if we only wanted to use the custom template on the page with an ID of 7830 we could add the following to header.php:</p>
<pre class="brush: php;">
&lt;?php
if ($post-&gt;ID == 7830) {
	echo '&lt;link rel=&quot;stylesheet&quot; href=&quot;'.get_bloginfo('stylesheet_directory').'/includes/mypage.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;';
}
?&gt;
</pre>
<p>This would only call the external CSS file for the page with the specified ID. Note that the IF condition can be adapted to our needs. If we wanted to call the same external stylesheet for multiple pages, we could check for the existence of a custom field, or perhaps a certain tag, etc. The possibilities are endless.</p>
<p>The problem with this solution is that <strong>it&#8217;s messy</strong>. What if you plan to use multiple custom page templates and want a different stylesheet for each one? Your header.php will be filled with conditionals. It&#8217;s far better to find a solution where you can call the external CSS file from the custom page template.</p>
<h2>My Solution &#8211; Add_action Function With Wp_head Hook</h2>
<p>Although I&#8217;m starting to play with <strong>WordPress themes</strong>, my background is in <a title="My WordPress plugins page" href="http://www.scratch99.com/wordpress-plugins-by-stephen-cronin/">WordPress plugins</a>. If I wanted to call an external CCS file from a plugin, I&#8217;d use the <strong>add_action function</strong> with the <strong>wp_head hook</strong>. There&#8217;s really no difference between plugins and themes when using WordPress functions, so this technique works just as well in a custom page template. </p>
<p>Here&#8217;s how to do it:</p>
<pre class="brush: php;">
&lt;?php
function mypage_head() {
	echo '&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;'.get_bloginfo('stylesheet_directory').'/includes/mypage.css&quot;&gt;'.&quot;\n&quot;;
}
add_action('wp_head', 'mypage_head');
?&gt;
&lt;?php get_header(); ?&gt;
</pre>
<p>First, we define a simple function called mypage_head that echos the HTML code calling the external stylesheet. That&#8217;s all it does. Of course, you could echo anything here, such as a call to a JavaScript file, a meta tag, etc.</p>
<p>Next, we use the <strong>add_action function</strong>, with the <strong>wp_head hook</strong>, to call the mypage_head function. This tells WordPress to run our function whenever the wp_head function is called (this is called by your header.php).</p>
<p>Lastly, we call <strong>header.php</strong> using the <strong>get_header function</strong>. This calls wp_head and WordPress remembers to the mypage_head function and your code is added.</p>
<p>It&#8217;s not messy, because all <strong>the code is in the custom page template</strong>. You can leave header.php as it is. But it doesn&#8217;t require you to remember to change code if you change header.php, because you&#8217;re <strong>re-using header.php</strong>.</p>
<h2>Final Thoughts</h2>
<p>That&#8217;s my solution: to use the <strong>add_action fuction</strong> to add something to the header. <strong>What do you use?</strong> I know there are other solutions out there (including plugins), so I&#8217;d be interested in hearing what you do.</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/03/custom-page-template-external-css-file/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Poll &#8211; Which WordPress Theme Framework To Use?</title>
		<link>http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/</link>
		<comments>http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 13:32:08 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[poll]]></category>
		<category><![CDATA[theme frameworks]]></category>
		<category><![CDATA[wordpress themes]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/.So far, my WordPress development work has consisted of writing WordPress plugins and occasionally hacking themes. I&#8217;ve always said that I wanted to write a WordPress theme from scratch, but never had time to do so. One of my sites is going to need a [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/">http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/</a>.<br /><p>So far, my WordPress development work has consisted of writing <a title="My WordPress plugins page" href="http://www.scratch99.com/wordpress-plugins-by-stephen-cronin/">WordPress plugins</a> and occasionally hacking themes. I&#8217;ve always said that I wanted to write a WordPress theme from scratch, but never had time to do so. One of my sites is going to need a redesign shortly, so here&#8217;s my big opportunity.</p>
<p>However, with the rise of the <strong>WordPress theme framework</strong> and the limited time available to me, I&#8217;ve started thinking that the sensible thing to do is use a theme framework. But which one? </p>
<h2>What Is A Theme Framework?</h2>
<p>I&#8217;m not going to answer this definitively, because it&#8217;s too large a topic!</p>
<p>The short answer is that a Wordpress theme framework is a base that can be used to write a WordPress theme on top of. Most of the work is already done for you. There&#8217;s generally no need to call WordPress functions. All you need to do is create the style (via CSS) and add any custom functions you might need.</p>
<p>Of course, it&#8217;s not really that simple, as many theme frameworks extend WordPress by creating hooks that can be used for advanced customisation and make use of <strong>child themes</strong>, so you can upgrade the theme framework core without your changes being affected.</p>
<h2>What Are The Choices?</h2>
<p>There are quite a few <strong>WordPress theme frameworks</strong> out there, but the most popular ones seem to be:</p>
<ul>
<li>Ian Stewart&#8217;s <a href="http://themeshaper.com/thematic-for-wordpress/" target="_blank">Thematic</a></li>
<li>Justin Tadlock&#8217;s <a href="http://themehybrid.com/themes/hybrid" target="_blank">Hybrid</a></li>
<li>Alex King&#8217;s <a href="http://carringtontheme.com/" target="_blank">Carrington</a></li>
<li>Ptah Dunbar&#8217;s <a href="http://wpframework.com/" target="_blank">WPFramework</a></li>
</ul>
<p>There are also <strong>Premium WordPress Theme Frameworks</strong>, such as Chris Pearson&#8217;s <a href="http://diythemes.com/thesis/" target="_blank">Thesis</a>, but I&#8217;m not going to pay for one when there are so many great free options.</p>
<p>It&#8217;s worth acknowledging Scott Wallick&#8217;s <a href="http://www.plaintxt.org/themes/sandbox/" target="_blank">Sandbox</a> which is the granddaddy of the theme framework concept and which influenced many of the theme frameworks listed above.</p>
<h2>Tell Me Which Theme Framework You Would Use!</h2>
<p>There&#8217;s too much choice! I don&#8217;t know the difference between these <strong>theme frameworks</strong>, so I&#8217;m not sure which way to go. They all seem good and are created by WordPress developers with great reputations. </p>
<p>I&#8217;m leaning toward <strong>Thematic</strong> or <strong>Hybrid</strong> at the moment. For some reason, I have the feeling that <strong>Carrington</strong> is over the top for what I need, but I may be totally off base here. I&#8217;m also tempted by the <strong>Sandbox</strong> (sometimes I have to fight my instinct to do things the hard way!).</p>
<p>I&#8217;m rather short on time, so rather than spend days trying and comparing these frameworks, I thought I&#8217;d ask you &#8211; which framework would you use? If you have an opinion, please take part in the poll:</p>
Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.
<h2>Final Thoughts</h2>
<p>It&#8217;s exciting times for theme developers. <strong>WordPress theme frameworks</strong> can save us a lot of time. It&#8217;s just a little confusing to know which one to use. I hope this poll can help show what the community is thinking at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/02/poll-wordpress-theme-frameworks/feed/</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
		<item>
		<title>XAMMPLite Virtual Directory And WordPress Permalinks</title>
		<link>http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/</link>
		<comments>http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 13:17:43 +0000</pubDate>
		<dc:creator>Stephen Cronin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[permalink]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[xammplite]]></category>

		<guid isPermaLink="false">http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/</guid>
		<description><![CDATA[Copyright © 2010 Stephen Cronin. Visit the original article at http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/.When I&#8217;m working on WordPress related development (ie themes and plugins), I like to run WordPress locally. This is great for trying things out before it goes live and also lets me squeeze in some development time in on the train! 
My web server package [...]]]></description>
			<content:encoded><![CDATA[Copyright © 2010 <a href="http://www.scratch99.com">Stephen Cronin</a>. Visit the original article at <a href="http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/">http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/</a>.<br /><p>When I&#8217;m working on WordPress related development (ie themes and plugins), I like to <strong>run WordPress locally</strong>. This is great for trying things out before it goes live and also lets me squeeze in some development time in on the train! </p>
<p>My web server package of choice is <strong>XAMMP Lite</strong>, the Apache distribution that contains PHP and MySQL. Works great in general, but I had some <strong>problems with WordPress permalinks and XAMMP Lite</strong>. Here&#8217;s the solution.</p>
<div class="csstextbox1">Trivia: In the past, I was forced to use IIS as my web server, because Apache had a known bug that conflicted with my Internet connection. Basically, I could have Apache running locally OR an Internet connection, but not both! So IIS it was. However, I recently changed ISP and was freed from this constraint!</div>
<h2>My XAMMPLite / WordPress Environments</h2>
<p>It&#8217;s important to note that I keep the XAMMPLite and WordPress environments separate. Rather than copying each WordPress site into the XAMPP Lite structure, I keep it in a separate folder and set up a <strong>Virtual Directory</strong> pointing to it. This makes it easier to keep track of things. </p>
<p>For example, rather than putting the WordPress installation for the site I&#8217;m working on in <code>c:\xampplite\htdocs</code>, I store it in <code>c:\dev\sites\sitename</code>. I then set up a <strong>Virtual Directory </strong>so that XAMPP Lite&#8217;s Apache installation can find the folder and can serve it via <code>http://localhost/sitename</code>.</p>
<p>Now, I&#8217;m no Apache expert, but setting up a Virtual Directory was pretty easy: I simply added the following lines to the Apache configuration file (<code>C:\xampplite\apache\conf\httpd.conf)</code>, substituting sitename with the appropriate name:</p>
<pre class="brush: xml;">
Alias /sitename &quot;C:\dev\sites\sitename&quot;
&lt;Directory &quot;C:\dev\sites\sitename&quot;&gt;
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
&lt;/Directory&gt;
</pre>
<p>This gave me a virtual directory that worked, but I couldn&#8217;t get the WordPress permalinks to work properly. </p>
<h2>The Permalink Problem</h2>
<p>What was the problem with the permalinks? For me, all of my posts and pages returned a 404 error. Great! </p>
<p>There&#8217;s a workaround: put <code>/index.php/</code> at the start of the permalink structure (ie <code>/index.php/%postname%/</code>). However, while this works, it means that the local permalink structure will be different from that on the live site.</p>
<p>That&#8217;s no good for me. The menu links for my themes are often hardcoded, at least to the extent that they will break if the permalink structure changes. I don&#8217;t want to have to recode the theme to run it locally!</p>
<p>At least the root cause of the problem was obvious: <strong>XAMMP Lite was ignoring the .htaccess file created by WordPress</strong>. I just needed to get XAMMP Lite to respect the WordPress .htaccess file. I knew there had to be a way to do this.</p>
<h2>The Solution</h2>
<p>It turned out the problem was caused by the code I used to set up the Virtual Directory. As I said, <strong>I&#8217;m no Apache expert</strong>! I found the solution on <a href="http://rudyegenias.wordpress.com/2006/09/14/apache-2-virtual-directory-the-xampp-approach/" target="_blank">rudy egenias jr&#8217;s site</a>. Instead of the code above, I should have entered the following (in the <code>C:\xampplite\apache\conf\httpd.conf</code> file):</p>
<pre class="brush: xml;">
Alias /sitename &quot;C:\dev\sites\sitename&quot;
&lt;Directory &quot;C:\dev\sites\sitename&quot;&gt;
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/Directory&gt;
</pre>
<p>Note the differences: AllowOverride has changed from <em>None</em> to <em>All</em>. Options has changed from <em>Indexes MultiViews</em> to <em>Indexes FollowSymLinks Includes ExecCGI.</em></p>
<p>Problem almost solved. There&#8217;s one more thing to check to make sure that the WordPress permalinks work: In the <code>httpd.conf</code> file we have to make sure that the following line is uncommented (ie remove the ; before it):</p>
<pre class="brush: xml;">
LoadModule rewrite_module modules/mod_rewrite.so
</pre>
<p>Once that&#8217;s done, <strong>WordPress Permalinks should work perfectly with XAMMP Lite</strong>. Mission accomplished.</p>
<script type="text/javascript">Nifty("div.csstextbox1","bgcolor-#FFFFFF");</script>]]></content:encoded>
			<wfw:commentRss>http://www.scratch99.com/2009/02/xammplite-virtual-directory-and-wordpress-permalinks/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
