<?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/"
xmlns:media="http://search.yahoo.com/mrss/"
><channel><title>YoastWordPress Themes - Archives - Yoast - Tweaking Websites</title> <atom:link href="http://yoast.com/tag/wordpress-themes/feed/" rel="self" type="application/rss+xml" /><link>http://yoast.com</link> <description>Tweaking Websites</description> <lastBuildDate>Thu, 02 Sep 2010 14:00:08 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <image><title>Yoast</title> <url>http://cdn.yoast.com/wp-content/themes/yoast-v2/images/yoast-logo-rss.png</url><link>http://yoast.com</link> <width>144</width> <height>103</height> <description>Tweaking Websites</description> </image> <item><title>Quick tip: paths and URLs in WordPress</title><link>http://yoast.com/paths-urls-wordpress/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=paths-urls-wordpress</link> <comments>http://yoast.com/paths-urls-wordpress/#comments</comments> <pubDate>Wed, 01 Sep 2010 14:00:37 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=3041</guid> <description><![CDATA[<p>I was reading an article on Sitepoint about custom write panels the other day when I got heavily annoyed. The direct reason for this was one of their code examples and the authors apparent incomplete knowledge of the WordPress API's most basic functions and constants. In that example, he does the following: define&#40; 'MY_WORDPRESS_FOLDER',  $_SERVER&#91;'DOCUMENT_ROOT'&#93; [...]</p><p><a
href="http://yoast.com/paths-urls-wordpress/">Quick tip: paths and URLs in WordPress</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>I was reading an <a
href="http://www.sitepoint.com/blogs/2010/08/26/guide-to-wordpress-custom-write-panels/">article</a> on Sitepoint about custom write panels the other day when I got heavily annoyed. The direct reason for this was one of their code examples and the authors apparent incomplete knowledge of the WordPress API's most basic functions and constants. In that example, he does the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>  
  <span style="color: #0000ff;">'MY_WORDPRESS_FOLDER'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #009900;">&#93;</span>  
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>  
  <span style="color: #0000ff;">'MY_THEME_FOLDER'</span><span style="color: #339933;">,</span>  
  <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>  
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>  
  <span style="color: #0000ff;">'MY_THEME_PATH'</span><span style="color: #339933;">,</span>  
  <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span>  
    MY_THEME_FOLDER<span style="color: #339933;">,</span>  
    stripos<span style="color: #009900;">&#40;</span>MY_THEME_FOLDER<span style="color: #339933;">,</span><span style="color: #0000ff;">'wp-content'</span><span style="color: #009900;">&#41;</span>  
  <span style="color: #009900;">&#41;</span>  
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>That annoyed me, quite a bit. Why? Well because if people write articles about stuff like custom write panels, I expect them to know a bit about the basics of the WordPress API. And well, the WordPress API has constants and functions for these things. So let me introduce you to them in the same order as the author of the articles did his defines above:</p><h2>ABSPATH constant</h2><p>Not only is their method inconvenient, it's wrong for a lot of installs. You see, some people install WordPress in a subdirectory, and depending on what you need, there are two different paths you might need. <code>ABSPATH</code> is a constant that always returns the home of WordPress. So if WordPress is in the <code>wp/</code> subdirectory, it would give you something like: <code>/home/username/public_html/wp/</code>. If WordPress were installed in the root, it would just return <code>/home/username/public_html/</code>. Now I don't know how they're using it, as it's not used in this particular article, but they'd have to be very cautious with that.</p><h2>TEMPLATEPATH constant</h2><p>The second two things they're doing are possibly even weirder. First they define a constant <code>MY_THEME_FOLDER</code>, which is basically the path to the current theme. WordPress has a very convenient constant for that: <code>TEMPLATEPATH</code>. Since they're using it in an include, that's probably what they need. Would save about 4 lines of code. Note that what they call a "folder" is actually a path.</p><h2>get_template_directory_uri()</h2><p>This is were they really go wrong. You see, they define a constant <code>MY_THEME_PATH</code>, and then use it as a URL in a call to <code>wp_enqueue_style()</code>, in other words: to enqueue a style sheet. Now paths and URLs are different animals altogether, and they don't mix well. Take this example:</p><ul><li>My blog is installed in a subdirectory <code>/wp/</code></li><li>Because of that <code>MY_THEME_FOLDER</code> has been defined as follows:<pre>/home/user/public_html/wp/wp-content/themes/example-theme</pre></li><li>The code that sets <code>MY_THEME_PATH</code> turns that into:<pre>/wp-content/themes/example-theme</pre></li><li>The stylesheet is now included with the following path:<pre>/wp-content/themes/example-theme/custom/book_panel.css</pre></li><li>This causes a 404 (file not found error) because that directory simply doesn't exist! It should have been:<pre>/wp/wp-content/themes/example-theme/custom/book_panel.css</pre></li></ul><p>The proper way of doing the enqueue would thus have been the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_style<span style="color: #009900;">&#40;</span>  
    <span style="color: #0000ff;">'my_meta_css'</span><span style="color: #339933;">,</span>  
     get_template_directory_uri<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'/custom/book_panel.css'</span>  
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><h2>Conclusion</h2><p>I hope you understand why this annoys me. This is exactly the kind of coding that gives WordPress coders out there a bad name, as 5 - 10% of people out there trying this will not get it to work. If you want to prevent from making such mistakes, there's plenty of resources to learn about these things, or look them up. Two starting points would be the <a
href="http://codex.wordpress.org/">codex</a> and my own <a
href="http://xref.yoast.com/">cross reference of the WordPress source</a> along with its very convenient <a
href="http://xref.yoast.com/wp.html">WordPress source search function</a>.</p><p><a
href="http://yoast.com/paths-urls-wordpress/">Quick tip: paths and URLs in WordPress</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/paths-urls-wordpress/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Why functionality in themes is not always good.</title><link>http://yoast.com/theme-functionality-issues/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=theme-functionality-issues</link> <comments>http://yoast.com/theme-functionality-issues/#comments</comments> <pubDate>Wed, 25 Aug 2010 13:56:47 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=2895</guid> <description><![CDATA[<p>So you've switched over to a theme that comes with built-in functionality for titles and meta descriptions. Instead of using HeadSpace2, All in one SEO or another SEO plugin, you're now using the theme's built-in SEO functions and input boxes for title's and meta descriptions. It just seems more logical doesn't it? Loading one plugin [...]</p><p><a
href="http://yoast.com/theme-functionality-issues/">Why functionality in themes is not always good.</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><img
src="http://cdn.yoast.com/wp-content/uploads/2010/08/frustration1.jpg" alt="Frustration because of using WordPress functionality that should NOT be in your theme" title="Frustration because of using WordPress functionality that should NOT be in your theme" width="200" height="159" class="alignright size-full wp-image-2953" />So you've switched over to a theme that comes with built-in functionality for titles and meta descriptions. Instead of using HeadSpace2, All in one SEO or another SEO plugin, you're now using the theme's built-in SEO functions and input boxes for title's and meta descriptions. It just seems more logical doesn't it? Loading one plugin less and using the theme's functionality. It feels like that's how it should be. I mean, that should be faster, right?</p><p><strong>Wrong.</strong> Why that's wrong? Let's say that, a year from now, you're tired of this theme and want something else. It happens to all of us. So, you're switching themes. Have you guessed the problem yet? Because that theme you started using the titles and descriptions of uses it's own methods and locations for storing those titles and descriptions, when you switch to another theme, it won't recognize the old stuff.</p><p>If you're smart, you'll notice. If you're not, you'll be in even deeper trouble, as someone I did a <a
href="http://yoast.com/hire-me/site-analysis/">site review</a> for recently found out. She'd written superb SEO titles and meta's for her last 50 odd posts, and the hundreds of posts before that didn't have them. Took us a while to figure out she'd switched themes...</p><p>If you're a developer, changing a couple of post meta fields in the database might be reasonably easy, but for most people, it's not. That's why your theme should only contain functionality that alters the <em>looks</em> and the <em>code</em> of your site, not the content.</p><h2>So there are no "SEO friendly themes"?</h2><p>Does this mean a theme couldn't be SEO friendly? No it doesn't. A theme still determines a large part of what your heading structure looks like, whether it shows your content first and then your navigation or the other way around, whether your code is clean and tight or all messy etc. etc. etc. These are all very important aspects of on-page SEO, and I applaud every theme developer thinking about this and trying to learn about it.</p><h2>Conclusion</h2><p>There's a reason why we've got plugins and themes. We want to separate content from design. If something has to deal with your content, stuff you'd want to be the same regardless of which theme you're using, it <em>has</em> to be a plugin.</p><p><strong>Update</strong>: Nathan has released his <a
href="http://wordpress.org/extend/plugins/seo-data-transporter/">SEO Data Transporter plugin</a>, which allows you to "transport" your data from one plugin to another, or from a theme to a plugin etc. This makes the technical <em>fix</em> easier, but still doesn't take care of the fact that people switch themes and simply forget about things like these. So my stance remains that it is a bad idea to have this functionality in your theme.</p><p><a
href="http://yoast.com/theme-functionality-issues/">Why functionality in themes is not always good.</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/theme-functionality-issues/feed/</wfw:commentRss> <slash:comments>28</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/08/frustration1-125x125.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2010/08/frustration1.jpg" medium="image"> <media:title type="html">Frustration because of using WordPress functionality that should NOT be in your theme</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/08/frustration1-125x125.jpg" /> </media:content> </item> <item><title>Outsource slicing &amp; coding of your WordPress themes</title><link>http://yoast.com/psd-wordpress-theme-competition/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=psd-wordpress-theme-competition</link> <comments>http://yoast.com/psd-wordpress-theme-competition/#comments</comments> <pubDate>Wed, 19 May 2010 10:03:00 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[setting up a website]]></category> <category><![CDATA[small businesses]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=2291</guid> <description><![CDATA[<p>In last nights episode of the WordPress Podcast we discussed setting up a website for small businesses in WordPress. One of the things I touched on in that discussion is that we outsource a lot of our development work, especially slicing PSD's to HTML or even directly to WordPress themes, both for Yoast and for [...]</p><p><a
href="http://yoast.com/psd-wordpress-theme-competition/">Outsource slicing &#038; coding of your WordPress themes</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><img
class="alignright size-full wp-image-2292" title="shophtml" src="http://cdn.yoast.com/wp-content/uploads/2010/05/shophtml.png" alt="" width="169" height="102" />In last nights episode of the <a
href="http://wp-community.org/">WordPress Podcast</a> we discussed <a
href="http://wp-community.org/2010/05/19/small-business-fundamentals/">setting up a website for small businesses in WordPress</a>. One of the things I touched on in that discussion is that we outsource a lot of our development work, especially slicing PSD's to HTML or even directly to WordPress themes, both for Yoast and for OrangeValley.</p><p>I thought it might be useful for all of you to share with you which company we use for that. We've worked with several of them, some of them good, some of them not so good, but we've had the best experience working with a company called <a
class="clicky_log_outbound" href="http://yoast.com/out/shophtml/">ShopHTML</a>.</p><p>The difference, for projects that we do, is in the level of customization teams are able to do to a theme without having to be told specifically what to do. If we include star ratings in a design, ShopHTML will usually come back to us and say "hey, we've got this solution, would that work for you" instead of just adding the stars as images into what actually should be a fully functional WordPress theme.</p><h2>Win a free PSD to WordPress Theme conversion!</h2><p>I talked about sharing this with all of you with Absar from ShopHTML, (who's btw very responsive through email and IM, something we always appreciate in an outsourcing partner). Rather than doing some affiliate scheme we decided we'd make it fun for everyone: we're going to be giving away a free PSD design to WordPress theme conversion (and I get one too myself, it's good to be me sometimes). All you have to do is come up with a suggestion for a post you want me to do, here on Yoast.com, and leave a comment below on what the post should be on, and why you'd want me to talk about that topic specifically.</p><p>Next week, wednesday May 26th, at noon CET this competition closes, and I'll pick a winner! The winner will not only get his or her free PSD design to WordPress conversion, but also the post they asked for, so, let's hear those great ideas!</p><p><a
href="http://yoast.com/psd-wordpress-theme-competition/">Outsource slicing &#038; coding of your WordPress themes</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/psd-wordpress-theme-competition/feed/</wfw:commentRss> <slash:comments>57</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/05/shophtml-125x102.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2010/05/shophtml.png" medium="image"> <media:title type="html">shophtml</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/05/shophtml-125x102.png" /> </media:content> </item> <item><title>Implementing hreview in your WordPress theme</title><link>http://yoast.com/implement-hreview-wordpress-theme/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=implement-hreview-wordpress-theme</link> <comments>http://yoast.com/implement-hreview-wordpress-theme/#comments</comments> <pubDate>Sun, 28 Feb 2010 14:00:49 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[hreview]]></category> <category><![CDATA[Microformats]]></category> <category><![CDATA[review]]></category> <category><![CDATA[rich snippets]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=2057</guid> <description><![CDATA[<p>In his previous post here on Yoast, Frederick explained why you should use Microformats to increase the CTR from Google. In the comments of that post, people were asking if there are plugins to easily implement this in your theme. While those are probably a bit hard to do, I though it would be good [...]</p><p><a
href="http://yoast.com/implement-hreview-wordpress-theme/">Implementing hreview in your WordPress theme</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>In his <a
title="Google &amp; Microformats: Drive More Traffic" href="http://yoast.com/google-microformats-conversion-rate-optimization-serps/">previous post</a> here on Yoast, Frederick explained why you should use Microformats to increase the CTR from Google. In the comments of that post, people were asking if there are plugins to easily implement this in your theme. While those are probably a bit hard to do, I though it would be good to explain how I implemented <code>hreview</code> in my theme.</p><h2 id="activate">How I "activate" a review</h2><p>I alluded to it in <a
title="Fireside Chat with Dougal Campbell, An Early WordPress Developer - WordPress Community Podcast" href="http://www2.webmasterradio.fm/wordpress-community-podcast/2010/02/23/fireside-chat-with-dougal-campbell-an-early-wordpress-developer/">last tuesdays podcast with Dougal Campbell</a>: When I add a custom field "rating" to a post, my theme now automatically marks up that post as an <code>hreview</code> microformat. So it's as simple as this:</p><p><a
href="http://cdn.yoast.com/wp-content/uploads/2010/02/rating-custom-field.jpg"><img
class="aligncenter size-full wp-image-2058" title="Rating Custom Field" src="http://cdn.yoast.com/wp-content/uploads/2010/02/rating-custom-field.jpg" alt="Rating Custom Field" width="450" height="130" /></a></p><p>The rating is between 0 and 5, because that way Google understands it best and we don't have to give Google any extra metadata about it.</p><h2 id="echo">The hreview_echo function</h2><p>To make this whole process easy, I've created a function in my <em>functions.php</em> file called <code>hreview_echo</code>. It looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$rating</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rating'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rating</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">echo</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>We'll use this function on the several places where we need to add extra classes to make up the <code>hreview</code>.</p><h2 id="wrapper">The wrapper class: hreview</h2><p>The first class we should add is the wrapper for the entire microformat: the <code>hreview</code> class. This should be on the <code>div</code> surrounding the post (this div should include the title and author). In the default theme (and in mine) it looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;div <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;</pre></div></div><p>In this case the class of this div is actually put out by the WordPress core <code>post_class()</code> function, so we'll need to hook into that function. Luckily it allows us to easily do that using a filter, which we'll do using the functions below, which you can drop into your <em>functions.php</em> too:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> hreview_post_class<span style="color: #009900;">&#40;</span><span style="color: #000088;">$classes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$review</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rating'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$review</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$classes</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'hreview'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$classes</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_class'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'hreview_post_class'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>If your theme doesn't use the <code>post_class()</code> function, it's even easier! Let's say your post div looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div><p>You can just use our <code>hreview_echo()</code> function:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;post<span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' hreview'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;</pre></div></div><h2 id="item">The item reviewed: the title</h2><p>Next up in the line of things we have to add a class to is the post title, it needs two classnames: the <code>item</code> and <code>fn</code> classes. In my case it looked like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;</pre></div></div><p>This is easily turned into the following, again using the <code>hreview_echo</code> function we created before:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;h1 <span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' class=&quot;item fn&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;</pre></div></div><h2 id="date">The date of the review</h2><p>For the date we'll have to work it a bit. The hreview microformat determines the date should be in ISO date format. Meaning the date should look like: 2010-03-01. Your theme probably has another way of showing the date, I know mine does. My date looked like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;span class=&quot;date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d F Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;</pre></div></div><p>Now to make it so that it can still look like that but we can also give the microformat the correctly formatted date, we'll use a trick: by adding a <code>span</code> with a class of <code>value-title</code> and then adding the correct date in the <code>title</code> of that span, microformat parsers will ignore the other content and pick the value from that title.</p><p>So we'll turn it into this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;span class=&quot;date<span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' dtreviewed'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;value-title&quot; title=&quot;'</span><span style="color: #339933;">.</span>
        get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;/&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d F Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/span&gt;</pre></div></div><p>This outputs:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;date dtreviewed&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;value-title&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;2010-02-10&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  10 February 2010
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><p>That's a nice, non-intrusive solution, right?</p><h2 id="author">The reviewer: the author</h2><p>The next class we need to add is the <code>reviewer</code> class, as this is the author of the review, that's a simple one too: it's the author of the post. In my theme, my author block looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;span class=&quot;author&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;</pre></div></div><p>Now you'll get by now what we'll do:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;span class=&quot;author<span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' reviewer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/span&gt;</pre></div></div><p>Easy does it, right? You can basically do something like this with any kind of showing the author's name. Other functions that might be used in your theme are for instance <code>the_author_link()</code> or <code>the_author_posts_link()</code>.</p><h2 id="summary">The content of the review</h2><p>We've done more than half of it now! Let's get going with the contents of the review, in the microformat, this needs the class <code>description</code>.  In my theme, just like in the default kubrick theme, the content is wrapped in the following div:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;entry&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div><p>You've guessed it by now haven't you? Here we go:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry<span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;</pre></div></div><p>By the way: if you want to mark up articles on for instance your fronpage as hreview too, and you use excerpts there instead of full articles, like I do, you should use <code>summary</code>, instead of <code>description</code>:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry<span style="color: #000000; font-weight: bold;">&lt;?php</span> hreview_echo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' summary'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;</pre></div></div><h2 id="therating">Finally: the rating!</h2><p>And now, finally, it's time for us to add the rating, because that's what it's all about right? There's all sorts of ways to display a rating, I have chosen to do it in HTML that looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;rating&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>My rating:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;4.5 out of 5 stars&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;rating_bar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;width:90%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><p>Which outputs this:</p><div
class="rating">My rating:</div><div
class="rating_bar" title="4.5 out of 5 stars"><div
style="width:90%"></div></div><p><br
class="clear" /><br
/> The second div (class <code>rating_bar</code>) displays the rating, and it contains the empty stars. The div within that contains the yellow stars, and fills the stars up to where they need to be.</p><p>The CSS for these 3 divs looks like this:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.rating</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.rating_bar</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">55px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/stars.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.rating_bar</span> div <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/stars.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">-13px</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p>Download the (sprited) image of the stars <a
href="http://cdn.yoast.com/wp-content/themes/yoast-v2/images/stars.gif ">here</a>.</p><p>Now we'll need to do two things: dynamically output the size of the inner div within <code>rating_bar</code>, and make the rating readable for a microformat parser.</p><p>To display the rating, because it's a value between 0 and 5, we'll multiply it by 20. To make the output parseable by a microformat parser, we'll use the same <code>value-title</code> trick we used before. Finally, we'll turn this all into a function to display the rating, which you can drop into your <em>functions.php</em>, just like the two functions before.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> display_hreview_rating<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$rating</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rating'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rating</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;div class=&quot;rating&quot;&gt;
      My rating:
      &lt;span class=&quot;value-title&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$rating</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;/&gt;
    &lt;/span&gt;&lt;/div&gt;
    &lt;div title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$rating</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> out of 5 stars&quot; class=&quot;rating_bar&quot;&gt;
      &lt;div style=&quot;width:<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rating</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>%&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>So, now you can just use the <code>display_hreview_rating()</code> function anywhere in your post where you want to display the rating. If there is no rating, it won't display anything.</p><h2 id="testing">Testing your hreview</h2><p>Testing your hreview markup can be done with multiple tools, but I myself found the <a
href="http://www.google.com/webmasters/tools/richsnippets">Google Rich Snippets tool</a> to be extremely useful. If you use <a
href="http://quixapp.com/">Quix</a>, just type 'snippet' on the post you want to test! In my case it outputs a snippet like this for my <a
href="http://yoast.com/easy-blog-backup/">review of a WordPress backup plugin</a>:</p><p><img
src="http://cdn.yoast.com/wp-content/uploads/2010/02/rich-snippet.jpg" alt="Rich Snippet hreview" title="Rich Snippet hreview" width="489" height="89" class="aligncenter size-full wp-image-2082" /></p><h2 id="pricerange">Bonus: pricerange and tags</h2><p>As you can see in the above snippet, it includes something that is not documented anywhere in <a
href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=146645#Individual_reviews">the official Google documentation for reviews</a>, but that Google does support: the pricerange.</p><p>Credit where credit is due: I first found this pricerange attribute when my colleague Eduard pointed me to <a
href="http://seogadget.co.uk/using-hreview-microformat-on-your-review-page/">this post by the SEOgadget guys</a>, which pointed to this <a
href="http://knol.google.com/k/google-rich-snippets-tips-and-tricks">Knol</a>. It's extremely useful and seems to basically allow for all sorts of text. People use it to display a pricerange in a €€ - €€€ style, or to display a "real" pricerange, like € 100 - € 150. In case of an individual review, you can just use it to tell what you paid for it.</p><p>Since what I paid for a product is not a real part of my theme, I just make it simple: when I tell that the plugin is free, I mark up that line as:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;">this plugin is completely <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;pricerange&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>free<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><p>If you <em>do</em> want to put the value into a custom field and display it, you could easily adapt one of the functions above to do that, I'll leave <em>that</em> as an exercise to you, the reader.</p><p>Another thing I found that Google recognizes is the class <code>tags</code>. That's <em>really</em> easy to do: I just added the class 'tags' around my tags. I don't know how Google uses that though, haven't seen it anywhere in the wild.</p><h2 id="final">A final note</h2><p>If you've modified your theme to mark up as hreview, please make sure to use <a
href="http://www.google.com/support/webmasters/bin/request.py?contact_type=rich_snippets_feedback">this form</a> to let Google know that you have. They might not show it if you don't fit their test segment though, because as Google states in <a
href="http://knol.google.com/k/google-rich-snippets-tips-and-tricks">the Knol</a>:</p><blockquote><p>Currently, review sites and social networking/people profile sites are eligible. We plan to expand Rich Snippets to other types of content in the future.</p></blockquote><p>I hope you've found this post useful, let me know in the comments if you've used it to add hreview to your (premium) theme, and feel free to post links to examples, I'd love to see them! If you're wondering: all code examples on this site, unless specifically otherwise stated, are MIT licensed: free to distribute, free to modify. Please do add a link to where you got the original code though.</p><p>It's my humble opinion that additions like these should make it into all the premium themes, because that's what <em>really</em> makes a premium theme premium, in my opinion. Happy coding!</p><p><a
href="http://yoast.com/implement-hreview-wordpress-theme/">Implementing hreview in your WordPress theme</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/implement-hreview-wordpress-theme/feed/</wfw:commentRss> <slash:comments>32</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/02/rating-custom-field-125x125.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2010/02/rating-custom-field.jpg" medium="image"> <media:title type="html">Rating Custom Field</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/02/rating-custom-field-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2010/02/rich-snippet.jpg" medium="image"> <media:title type="html">Rich Snippet hreview</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/02/rich-snippet-125x89.jpg" /> </media:content> </item> <item><title>Practical Guide to 404 Error Pages: What WordPress is Missing</title><link>http://yoast.com/404-error-pages-wordpress/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=404-error-pages-wordpress</link> <comments>http://yoast.com/404-error-pages-wordpress/#comments</comments> <pubDate>Tue, 03 Nov 2009 13:30:42 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Analytics]]></category> <category><![CDATA[Webdesign & development]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1645</guid> <description><![CDATA[<p>I make mistakes. You make mistakes. We all do. And some of these mistakes end up providing our readers with a 404 page. Chances are that page says "Error 404: file not found". How does that help your visitor? Instead of just identifying the problem, your 404 page needs to offer a solution. In the [...]</p><p><a
href="http://yoast.com/404-error-pages-wordpress/">Practical Guide to 404 Error Pages: What WordPress is Missing</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><a
href="http://www.semmys.org/2010/blogging-2010-winner/"><img
class="alignright" src="http://www.semmys.org/dm/badges/10/LBru.gif" alt="2010 SEMMY Runner-Up" /></a>I make mistakes. You make mistakes. We all do. And some of these mistakes end up providing our readers with a 404 page. Chances are that page says "Error 404: file not found". How does that help your visitor?</p><p><strong
style="font-size:120%;text-shadow:1px 1px 1px #aaa;"><em>Instead of just identifying the problem, your 404 page needs to offer a solution.</em></strong></p><p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/11/problems-solutions.jpg" alt="Crossing out problems and instead offering solutions" title="Crossing out problems and instead offering solutions" width="250" height="166" class="alignright size-full wp-image-1744" />In the default WordPress Kubrick theme the 404 page (<a
class="thickbox" rel="404s" title="Kubrick 404 - Ugly as hell" href="http://cdn.yoast.com/wp-content/uploads/2009/10/kubrick-4041.png">example</a>) is probably one of the ugliest pages you've ever seen, and chances are yours is not any better. Today is the time to end that. This post will provide you with <em>everything</em> you need to make your "404 - File not found" page a starting point instead of a dead end street.</p><p>The goal of a good 404 page is simple: to make sure visitors landing on it continue browsing your site, and find the content they came for. Let's get going.</p><h2>Get into your visitors mindset</h2><p>Get into the mindset of the person that just got to a 404 page on your site. They were expecting something else, if not, they wouldn't have gone there. So there's a couple of things you should absolutely <em>not</em> do:</p><p>First of all, considering they've probably clicked a link somewhere to get to that 404 page, whose fault is it that they're getting a 404? Theirs? No. Yours? It very well might be, so you'd better apologize.</p><p>Second, make sure the styling of your 404 page fits in with the rest of your site. Sometimes designers go overboard with their 404 pages, and make them look like, for instance, a Windows blue screen. This can have the very undesired effect of people leaving immediately.</p><p>Third, if you are going to make jokes, like that Windows blue screen, make sure it's a joke everyone gets. Especially when you're blogging in English, you might end up with a lot of readers for whom English is their second or third language. Your puns, though well intended, might be going nowhere because their mastery of the language isn't sufficient. Because of that they might leave... Is that worth it?</p><h2>Let's make a killer 404 page</h2><p>Ok so we know what not to do. We also know that the visitor came to your site looking for specific content, usually having followed a link from somewhere. Now it's time to start giving them ways of doing that. If you're not using WordPress and you're lazy, the <a
href="http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-useful.html">Google 404 widget</a> might be helpful. If you <em>are</em> using WordPress, we can do better than that.</p><p>Let's let us be inspired by some great 404 pages:</p><div
style="width:425px;height:130px;margin:0 auto;"><a
rel="404-inspire" class="thickbox" title="Apple's 404 page" href="http://cdn.yoast.com/wp-content/uploads/2009/10/apple-404.png"><img
src="http://cdn.yoast.com/wp-content/uploads/2009/10/apple-404-125x125.png" alt="apple-404" title="apple-404" width="125" height="125" class="alignleft size-thumbnail wp-image-1648" /></a><a
rel="404-inspire" class="thickbox" title="IBM's 404 page" href="http://cdn.yoast.com/wp-content/uploads/2009/10/ibm-404.png"><img
src="http://cdn.yoast.com/wp-content/uploads/2009/10/ibm-404-125x125.png" alt="ibm-404" title="ibm-404" width="125" height="125" class="alignleft size-thumbnail wp-image-1650" /></a><a
rel="404-inspire" class="thickbox" title="Conversion Rate Experts 404 page" href="http://cdn.yoast.com/wp-content/uploads/2009/11/cre.png"><img
src="http://cdn.yoast.com/wp-content/uploads/2009/11/cre-125x125.png" alt="cre" title="cre" width="125" height="125" class="alignleft size-thumbnail wp-image-1699" /></a></div><p
style="margin-top:10px;clear:both;">I'll be honest: the <a
href="http://conversion-rate-experts.com/">Conversion Rate Experts</a> guys have inspired the first version of my 404 page. They offer you 4 options to get to the content you were looking for:</p><ol><li>search</li><li>check the URL for misspellings</li><li>check the sitemap</li><li>start over at the homepage</li></ol><p>That's a <em>great</em> start. Apple gives you a sitemap straight away. Depending on your site's structure that might be a great idea too.</p><p>I wanted to add one more thing: a set of pages that actually might be related to the URL people had typed in. To do that, we'd have to parse the URL and see if there's something useful in there. Let's see what we have to work with:</p><h2>What data does a 404 error page provide?</h2><p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/11/404-error.jpg" alt="404-error" title="404-error" width="250" height="134" class="alignleft size-full wp-image-1729" />A lot of people seem to think that a 404 page is a dead end street. It's not, there's a whole lot of data that can help you find the content your visitor was looking for. Let's start with the URL: it contains something very useful. All the text that's there after the slash of your domain should be pointing you to what it is the person was looking for.</p><p>Luckily, WordPress stores that information for you. The <code>$wp_query->query_vars['name']</code> variable holds whatever was in there. It does do some replacing in there though, it replaces all weird entities with a dash (-). We'll use this bit of information to spice up your 404 error page.</p><p>First of all, let's check whether there's a direct match for that var in a page name once you strip out all the things that people sometimes add to your URL erroneously. (If you read on there's an adapted version of the Kubrick 404 page which you can use to update your own themes.)</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(.*)-(html|htm|php|asp|aspx)$/&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$1</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$posts</span> <span style="color: #339933;">=</span> query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_type=any&amp;name='</span><span style="color: #339933;">.</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>If that doesn't deliver results, you'll want to do a search for that word, to do that we'll have to rip out the dashes in the name, and then do the search. As we're going to re-use the <code>$s</code> variable further on, we'll do that outside of the if statement to check whether the previous query delivered results:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$posts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$posts</span> <span style="color: #339933;">=</span> query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_type=any&amp;s='</span><span style="color: #339933;">.</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Now we have an array with posts, at least, we hope we do, so let's check that, and loop through it:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$posts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;&lt;p&gt;Were you looking for &lt;strong&gt;one of the following&lt;/strong&gt; posts 
    or pages?&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>I've made an adapted version of the Kubrick 404 error page, which you can <a
id="kubrick404" href="http://cdn.yoast.com/wp-content/uploads/2009/11/404.zip">download here</a>.</p><p>There's a plugin that does something similar to the above, called <a
href="http://wordpress.org/extend/plugins/smart-404/">Smart 404</a>. It chooses to redirect the visitor to the first result it gets. It wouldn't be my preference, I actually want people to notice that the URL was wrong.</p><p>So now we have a great 404 page, but we haven't used all the data that we were provided with. Another bit of data the 404 provides is the referrer: someone linked to your page with a wrong URL, or is linking to a page that isn't there anymore. So we've got one thing left to do:</p><h2 id="404prevention">Preventing 404 error pages</h2><p>There's a very cool plugin called <a
href="http://wordpress.org/extend/plugins/404-notifier/">404 notifier</a> by Alex King, which can provide you with an RSS feed of the 404's on your site, and <a
href="http://urbangiraffe.com/plugins/redirection/">Redirection</a>, one of my all time favorite plugins, offers the same functionality. You could also use my own <a
href="http://yoast.com/wordpress/google-analytics/">Google Analytics for WordPress plugin</a>. It tracks the 404's as 404.html (look for them in your content report).</p><p>Using Google Analytics has the added advantage that it saves the referrer, so you know which URL the visitor originated from. This allows you to not only redirect the URL to the correct place, but also to ask the site that referred the visitor to fix the URL.</p><p>Another great way to keep track of 404's on your site is using <a
href="https://www.google.com/webmasters/tools/">Google Webmaster Tools</a>. In the Diagnostics - Crawl Errors area of Webmaster Tools Google gives you a great overview of what 404's it encountered on your site:</p><p><a
class="thickbox" href="http://cdn.yoast.com/wp-content/uploads/2009/11/google-crawl-errors.png"><img
src="http://cdn.yoast.com/wp-content/uploads/2009/11/google-crawl-errors-300x215.png" alt="google-crawl-errors" title="google-crawl-errors" width="300" height="215" class="aligncenter size-medium wp-image-1707" /></a></p><h2>Two Things you Need to Know about 404 pages</h2><p>These are things that WordPress is doing right, but it's good to know these things:</p><ul><li>Internet Explorer will only show your custom 404 page if it's larger than 512 bytes (hard to get smaller than that with WordPress).</li><li>404 is not only the name, it's also the HTTP header that the page should send, if not, you might end up with 404 pages in the search engines indexes. You can easily check this with a HTTP header checker.</li></ul><p>As said, no need to worry if you're using WordPress, but good to know these things.</p><p>There's really no excuse left now for a bad 404 page, so go fix yours! Once you've done that, drop your site's URL in the comments, and I'll make a small gallery of cool 404 pages in this post.</p><p><a
href="http://yoast.com/404-error-pages-wordpress/">Practical Guide to 404 Error Pages: What WordPress is Missing</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/404-error-pages-wordpress/feed/</wfw:commentRss> <slash:comments>78</slash:comments> <media:thumbnail url="http://www.semmys.org/dm/badges/10/LBru.gif" /> <media:content url="http://www.semmys.org/dm/badges/10/LBru.gif" medium="image"> <media:title type="html">2010 SEMMY Runner-Up</media:title> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/11/problems-solutions.jpg" medium="image"> <media:title type="html">Crossing out problems and instead offering solutions</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/11/problems-solutions-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/10/apple-404.png" medium="image"> <media:title type="html">apple-404</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/10/apple-404-125x125.png" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/10/ibm-404.png" medium="image"> <media:title type="html">ibm-404</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/10/ibm-404-125x125.png" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/11/cre.png" medium="image"> <media:title type="html">cre</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/11/cre-125x125.png" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/11/404-error.jpg" medium="image"> <media:title type="html">404-error</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/11/404-error-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/11/google-crawl-errors.png" medium="image"> <media:title type="html">google-crawl-errors</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/11/google-crawl-errors-125x125.png" /> </media:content> </item> <item><title>Quick WP tip #2: Conditional Thickbox loading</title><link>http://yoast.com/conditional-thickbox-loading/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=conditional-thickbox-loading</link> <comments>http://yoast.com/conditional-thickbox-loading/#comments</comments> <pubDate>Wed, 14 Oct 2009 20:19:27 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1621</guid> <description><![CDATA[<p>Another quick tip to help you optimize your site: sometimes you want to load one or more images in a post in a nice Thickbox or Lightbox. But in most cases, you don't need to load these scripts, wouldn't it be cool if you could load these scripts only when you want them to load? [...]</p><p><a
href="http://yoast.com/conditional-thickbox-loading/">Quick WP tip #2: Conditional Thickbox loading</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>Another quick tip to help you optimize your site: sometimes you want to load one or more images in a post in a nice <a
href="http://jquery.com/demo/thickbox/">Thickbox</a> or <a
href="http://www.huddletogether.com/projects/lightbox2/">Lightbox</a>. But in most cases, you don't need to load these scripts, wouldn't it be cool if you could load these scripts <em>only when you want them to load</em>?</p><p>I decided, that the only time I want Thickbox to load, is when I manually add <code>class="thickbox"</code> to the code of a post or page. So I wrote up a little script that checks for that, and loads Thickbox if needed. Now you need to know that to make Thickbox work, you need to load both a script and a css file, so the complete code is the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> yst_conditional_thickbox<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_singular<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> 
    <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'class=&quot;thickbox&quot;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_print_styles'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'yst_conditional_thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>This code should go into your themes <em>functions.php</em> file. Let's explain it a bit: the function checks whether the content of the post contains the text <code>class="thickbox"</code>. If it finds this text, it enqueues both the Thickbox script and CSS file. The <code>add_action</code> "hooks" this function to a WordPress hook. I use the <code>wp_print_styles</code> hook here, because that executes in the head, and makes sure both the stylesheet and the script file get loaded properly.</p><p>Now of course there's nicer ways of doing this, like making it into a full regex to see if class="thickbox" is actually set on a link, to prevent it from loading on a post like this one, which doesn't have a thickboxed image in it, but does contain the text. But let's be honest, how often is that really the case? This simple conditional load means you can use Thickbox when you need it, but you're not making your users download Thickbox all the time when you're only using it in 5% of your posts.</p><p>Let me know in the comments if this works for you, and which other things you think you should load conditionally, to make your blog a bit faster and more userfriendly!</p><p><a
href="http://yoast.com/conditional-thickbox-loading/">Quick WP tip #2: Conditional Thickbox loading</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/conditional-thickbox-loading/feed/</wfw:commentRss> <slash:comments>29</slash:comments> </item> <item><title>WordPress Debug Theme</title><link>http://yoast.com/wordpress-debug-theme/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-debug-theme</link> <comments>http://yoast.com/wordpress-debug-theme/#comments</comments> <pubDate>Wed, 14 Oct 2009 13:14:08 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1618</guid> <description><![CDATA[<p>Warning: major geekery ahead! Sometimes you need to see what's wrong with a WordPress install, and you need to see it fast. I've had a set of hacks around for a while to do that, but finally started combining it into a WordPress Debug Theme. This theme is quite simple for now, as it only [...]</p><p><a
href="http://yoast.com/wordpress-debug-theme/">WordPress Debug Theme</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><img
class="alignright size-full wp-image-1619" title="Yoast Debug Theme" src="http://cdn.yoast.com/wp-content/uploads/2009/10/screenshot.png" alt="Yoast Debug Theme" width="240" height="180" /><strong>Warning:</strong> major geekery ahead! Sometimes you need to see what's wrong with a WordPress install, and you need to see it fast. I've had a set of hacks around for a while to do that, but finally started combining it into a WordPress Debug Theme. This theme is quite simple for now, as it only does a few things, but does them quite effectively.</p><p>The first thing it does, on the homepage of the blog you've activated it on, is show the most important constants for that blog (<a
rel="gallery-debug-theme" class="thickbox" href="http://netdna.yoast.com/screenshots/debug-theme-1-20091014-145757.png">see this screenshot</a>). It shows you the important URL's, editor and memory settings etc.</p><p>On subpages it will show you something else: the page type, all the query vars that are set and the SQL query for that page. I've found that just doing a <code>print_r</code> or <code>var_dump</code> of <strong>$wp_query</strong> is hard to read, this theme tries to be a bit smarter about that, see <a
class="thickbox" rel="gallery-debug-theme"  href="http://netdna.yoast.com/screenshots/debug-theme-2-20091014-150235.png">these</a> <a
class="thickbox"  rel="gallery-debug-theme"  href="http://netdna.yoast.com/screenshots/debug-theme-3-20091014-150343.png">examples</a>.</p><p>This theme also works in the preview, so that might be enough in a lot of cases. It also works great together with Donncha's <a
href="http://wordpress.org/extend/plugins/theme-tester/">Theme Tester</a>, as <a
href="http://www.pixelapes.com/">Alex Leonard</a> mentioned in the comments. Be warned that you might want to remove this theme from live sites though!</p><p>So all you have to do to use this is <a
href="http://netdna.yoast.com/downloads/yoast-debug-theme.zip">download it</a>, upload it to your server and activate it.</p><p>If you're a developer this theme might come in handy sometimes, I'd love to know if you use it and what you'd add, maybe we can turn this into something <strong>super</strong> useful together.</p><p><a
href="http://yoast.com/wordpress-debug-theme/">WordPress Debug Theme</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/wordpress-debug-theme/feed/</wfw:commentRss> <slash:comments>49</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/10/screenshot-125x125.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/10/screenshot.png" medium="image"> <media:title type="html">Yoast Debug Theme</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/10/screenshot-125x125.png" /> </media:content> </item> <item><title>Quick WP tip: pagination classes</title><link>http://yoast.com/pagination-classes/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=pagination-classes</link> <comments>http://yoast.com/pagination-classes/#comments</comments> <pubDate>Tue, 06 Oct 2009 13:40:28 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1613</guid> <description><![CDATA[<p>One of my colleagues was working on a site for a client of ours, and needed to apply styling to the previous and next post link. As in most of our sites we use Lester Chan's excellent wp-pagenavi plugin so I dove into that to check how I could style it. Turns out Lester is [...]</p><p><a
href="http://yoast.com/pagination-classes/">Quick WP tip: pagination classes</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>One of my colleagues was working on a site for a client of ours, and needed to apply styling to the previous and next post link. As in most of our sites we use <a
href="http://lesterchan.net/">Lester Chan</a>'s excellent <a
href="http://wordpress.org/extend/plugins/wp-pagenavi/">wp-pagenavi plugin</a> so I dove into that to check how I could style it.</p><p>Turns out Lester is being very good about it and is using the WordPress internal functions <code><a
href="http://xref.yoast.com/trunk/nav.html?_functions/next_posts_link.html">next_posts_link</a></code> and <code><a
href="http://xref.yoast.com/trunk/nav.html?_functions/previous_posts_link.html">previous_posts_link</a></code>. This is good because both of these functions have a simple filter that we can hook onto to add a class to those links, and the code below will work in all instances, also when you're not using Lester's plugin but just plain old WordPress.</p><p>By default, those links don't have any classes on them, but by adding the following two simple functions to our <em>functions.php</em>, we can add those very easily:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> previous_posts_link_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'class=&quot;previouspostslink&quot;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'previous_posts_link_attributes'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'previous_posts_link_class'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> next_posts_link_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'class=&quot;nextpostslink&quot;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'next_posts_link_attributes'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'next_posts_link_class'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>If you've added these two functions to your <em>functions.php</em>, you can now use the <code> previouspostslink</code> and <code>nextpostslink</code> CSS classes to style these two links!</p><p><a
href="http://yoast.com/pagination-classes/">Quick WP tip: pagination classes</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/pagination-classes/feed/</wfw:commentRss> <slash:comments>17</slash:comments> </item> <item><title>Multilingual and Multi Domain Sites in WordPress</title><link>http://yoast.com/multilingual-multi-domain-corporate-sites-in-wordpress/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=multilingual-multi-domain-corporate-sites-in-wordpress</link> <comments>http://yoast.com/multilingual-multi-domain-corporate-sites-in-wordpress/#comments</comments> <pubDate>Fri, 17 Jul 2009 14:15:49 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Wordpress Seo]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1548</guid> <description><![CDATA[<p>One of the things we're doing more and more of recently is building multilingual, multi domain corporate sites in WordPress. Doing that used to be a fair amount of work, but we've been able to make it a lot simpler lately. We start the process with a simple WordPress MU install, to which we then [...]</p><p><a
href="http://yoast.com/multilingual-multi-domain-corporate-sites-in-wordpress/">Multilingual and Multi Domain Sites in WordPress</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>One of the things we're doing more and more of recently is building multilingual, multi domain corporate sites in WordPress. Doing that used to be a fair amount of work, but we've been able to make it a lot simpler lately.</p><p>We start the process with a simple WordPress MU install, to which we then add the <a
href="http://wpmudev.org/project/Multi-Site-Manager">Multi Site Manager plugin</a>, to be able to run multiple domains off of it. Now this is all pretty simple and straight forward. Now we used to have to build a theme in several languages, but we've recently developed some new stuff that makes that simpler.</p><h2>Localized templates</h2><p>One of the things I've done for the StudioPress themes is localize them, which is actually not even that much work if you read the <a
href="http://urbangiraffe.com/articles/localizing-wordpress-themes-and-plugins/">how to for it that John Godley wrote</a>. On top of doing that, we add some other code that I've written, which allows you to pick the language for a blog in the themes backend.</p><p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/07/lang-select.jpg" alt="language select" width="360" height="106" /></p><p>Now this means, that we can run a multi domain, multilingual site in 1 WordPress install, while maintaining only 1 theme.</p><h2>Localizing dates</h2><p>One of the other things you need to take care of when you're localizing your WordPress theme is localizing the date output. To be honest the way I'm doing that right now is a bit of a hack, but it allows for us to translate dates from within a theme, without having to use the backend in the other language. It works by adding stuff like this to the themes <em>functions.php</em>:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">weekday</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sunday'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'orangevalley'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>So now, we can have an english backend, and a frontend in as many different languages on as many different domains as we want, served from one WordPress MU install, with only one theme to maintain. How cool is that?</p><p><a
href="http://yoast.com/multilingual-multi-domain-corporate-sites-in-wordpress/">Multilingual and Multi Domain Sites in WordPress</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/multilingual-multi-domain-corporate-sites-in-wordpress/feed/</wfw:commentRss> <slash:comments>53</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/07/lang-select.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/07/lang-select.jpg" medium="image"> <media:title type="html">language select</media:title> </media:content> </item> <item><title>Remove Smilies, once and for all</title><link>http://yoast.com/remove-smilies-wordpress/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=remove-smilies-wordpress</link> <comments>http://yoast.com/remove-smilies-wordpress/#comments</comments> <pubDate>Mon, 13 Jul 2009 12:29:19 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress MailingList]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1533</guid> <description><![CDATA[<p>One of the most annoying features ever in WordPress is the "feature" to convert smilies into images of smileys, MSN style. Where lots of stuff like this is dismissed these days as "plugin territory", this annoying feature has been in WP since 0.71... Anyway, sometimes you'll want to disable this feature from within your theme, [...]</p><p><a
href="http://yoast.com/remove-smilies-wordpress/">Remove Smilies, once and for all</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>One of the most annoying features <em>ever</em> in WordPress is the "feature" to convert smilies into images of smileys, MSN style. Where lots of stuff like this is dismissed these days as "plugin territory", this annoying feature has been in WP since 0.71...</p><p>Anyway, sometimes you'll want to disable this feature from within your theme, or maybe even as a sitewide plugin to disable it all over your WordPress MU installation. It's pretty simple to do:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> yst_remove_smileys<span style="color: #009900;">&#40;</span><span style="color: #000088;">$bool</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'option_use_smilies'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'yst_remove_smileys'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>If you want to do that sitewide, add a plugin header to it and throw it in the mu-plugins dir of your WordPress MU installation.</p><p><a
href="http://yoast.com/remove-smilies-wordpress/">Remove Smilies, once and for all</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/remove-smilies-wordpress/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>On the GPL, Themes, Plugins &amp; Free.</title><link>http://yoast.com/on-the-gpl-themes-plugins-free/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=on-the-gpl-themes-plugins-free</link> <comments>http://yoast.com/on-the-gpl-themes-plugins-free/#comments</comments> <pubDate>Thu, 02 Jul 2009 19:23:04 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/on-the-gpl-themes-plugins-free/</guid> <description><![CDATA[<p>So, we've finally got an official word on this, the one sentence summary by Matt reads: PHP in WordPress themes must be GPL, artwork and CSS may be but are not required. Ok, so that's the final truth, because the Software Freedom Law Center (who are of course absolutely NOT partial in this, even though [...]</p><p><a
href="http://yoast.com/on-the-gpl-themes-plugins-free/">On the GPL, Themes, Plugins &#038; Free.</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>So, we've finally got an official word on this, the <a
href="http://wordpress.org/development/2009/07/themes-are-gpl-too/" target="_blank">one sentence summary by Matt</a> reads:</p><blockquote><p>PHP in WordPress themes must be GPL, artwork and CSS may be but are not required.</p></blockquote><p>Ok, so that's the final truth, because the Software Freedom Law Center (who are of course absolutely NOT partial in this, even though they're called the "Software Freedom Law Center") said so. Nice. Really nice actually as all I've done and released for WordPress, ever, has always been GPL, and I chose to work with <a
href="http://www.briangardner.com/" target="_blank">Brian</a> <em>because </em>his<em> </em>themes were GPL and the others were not (at the time).</p><p>You'd think I'd be happy, and I am, sort of. But I've got an itch that needs scratching. With this final statement, there's also a new page on WordPress.org for <a
href="http://wordpress.org/extend/themes/commercial/" target="_blank">Commercially supported GPL WordPress theme</a> makers, and <a
href="http://www.studiopress.com/" target="_blank">StudioPress</a> is among those of course.</p><p>So, all the theme makers who decide to go fully GPL (their artwork and CSS included), can get listed on that page. Well, good for them. You'd think, that by now, <a
href="http://ma.tt/" target="_blank">Matt</a> and <a
href="http://automattic.com/" target="_blank">Automattic</a> would have been smart enough to know who their friends and who their foes are. I'm not saying these theme makers aren't their friends. But there are these people out there, who have been building things that have been GPL all the time, who do NOT get that recognition.</p><p>Of course, we plugin authors get to host our own plugins on wordpress.org, and we can get links back to our site etc. But where's the page for <a
href="http://wordpress.org/extend/plugins/commercial/" target="_blank">commercially supported GPL WordPress PLUGINS</a> Matt? Don't you think it's time you started treating the plugin authors the same way as the theme authors? Or do we have to start a theme war for that first?</p><p>And yes I do have an interest in this, and <em>yes</em> I am planning on going the "commercially supported GPL" route with some of my plugins, just because keeping them all free doesn't make any sense any more. Free does other things, just as <a
href="http://www.amazon.com/Free-Future-Radical-Chris-Anderson/dp/1401322905/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1246561087&#038;sr=1-1" target="_blank">Chris Anderson</a> says, it has helped tremendously in getting my name out, but "free" doesn't make me rich, far from it even. I can be quite honest in that so far, in working with Brian on StudioPress... Well let's just say the effort to gain ratio is a LOT better.</p><p>The fact that people are able to build business models around a project, is the reason that projects grow. The premium theme market, started by Brian but also greatly pushed by my buddies at <a
href="http://www.woothemes.com/" target="_blank">WooThemes</a> and others, has increased development on themes tremendously: it has done the entire WordPress community a <em>lot</em> of good. (BTW, read Daniel Jalkut's post on the <a
href="http://www.red-sweater.com/blog/825/getting-pretty-lonely" target="_blank">GPL vs liberal licenses</a>, it's a very good read and offers some nice food for thought).</p><p>So my plea, to you, Matt, is to help people build up viable business models around WordPress Themes AND Plugins. For several reasons, including the fact that I'm loving to be able to make a living with it, but also because I think it will do the community a lot of good. And ow yeah, I'd love a <a
href="http://wordpress.org/extend/themes/commercial/#footer" target="_blank">haiku on WordPress.org</a> about me too!</p></p><p><a
href="http://yoast.com/on-the-gpl-themes-plugins-free/">On the GPL, Themes, Plugins &#038; Free.</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/on-the-gpl-themes-plugins-free/feed/</wfw:commentRss> <slash:comments>44</slash:comments> </item> <item><title>StudioPress and Yoast kick it off together</title><link>http://yoast.com/studiopress-yoast/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=studiopress-yoast</link> <comments>http://yoast.com/studiopress-yoast/#comments</comments> <pubDate>Thu, 28 May 2009 13:38:32 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Wordpress Seo]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1477</guid> <description><![CDATA[<p>This is quite big news for me, and for OrangeValley Projects, the development side of OrangeValley that we've been starting up over the last few months. In short: Brian Gardner, of StudioPress and Revolution fame, and myself, have decided to partner up, to provide better SEO'd themes to StudioPress customers. Brian is the one who [...]</p><p><a
href="http://yoast.com/studiopress-yoast/">StudioPress and Yoast kick it off together</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>This is quite big news for me, and for OrangeValley Projects, the development side of OrangeValley that we've been starting up over the last few months. In short: Brian Gardner, of StudioPress and Revolution fame, and myself, have decided to partner up, to provide better SEO'd themes to StudioPress customers.</p><p>Brian is the one who kickstarted the premium theme space, and he was also the first premium theme developer to realize that he could stick to the GPL and still have his themes be premium. As most of my readers will know, everything that I've ever coded for WordPress has always been released under the GPL, which is why I never went into the premium theme business before. But Brian's move to the GPL opened a series of possibilities for me.</p><p>So we are partnering up. I'm going to be optimizing all the <a
href="http://www.studiopress.com/">StudioPress</a> themes, and offering StudioPress customers advice on how to optimize their sites in regular blog posts and in a new blog optimization package we'll be offering through StudioPress.</p><p>Brian and myself are <em>very</em> happy with this new partnership, and look forward to creating a lot of very well designed, well SEO'd themes for all of you to build your sites with!</p><p>Now you'll ask what does this have to do with OrangeValley? Well, this agreement is actually between Brian and OrangeValley Projects, which is the new WordPress &#038; Magento development company we've recently started, and my colleagues in OrangeValley Projects will also be working on all of this.</p><p><a
href="http://yoast.com/studiopress-yoast/">StudioPress and Yoast kick it off together</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/studiopress-yoast/feed/</wfw:commentRss> <slash:comments>57</slash:comments> </item> <item><title>Optimizing WordPress database performance</title><link>http://yoast.com/wordpress-performance-optimization/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-performance-optimization</link> <comments>http://yoast.com/wordpress-performance-optimization/#comments</comments> <pubDate>Mon, 30 Mar 2009 19:26:45 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Blogging]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1471</guid> <description><![CDATA[<p>I've been working with a plugin that was mentioned on the wp-hackers list last week, called debug queries, to optimize the performance on some of my sites, including this one. The plugin was pretty easy to use, and I've improved a bit on it. I've sent the patch to Frank, who authored the original plugin, [...]</p><p><a
href="http://yoast.com/wordpress-performance-optimization/">Optimizing WordPress database performance</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>I've been working with a plugin that was mentioned on the wp-hackers list last week, called <a
href="http://wordpress.org/extend/plugins/debug-queries/">debug queries</a>, to optimize the performance on some of my sites, including this one. The plugin was pretty easy to use, and I've improved a bit on it. I've sent the patch to Frank, who authored the original plugin, and he was kind enough to immediately update the plugin.</p><p>When you're logged in as an admin, this plugin now shows the following info in an HTML comment tag in the footer of your pages:</p><ul><li>the query that was executed</li><li>the time it took to execute that query</li><li>the function path that led to this query, with the last function being the most likely to have created the query</li></ul><p>I've written down some of the things I encountered that you may encounter as well are the following:</p><h2>Empty options</h2><p>A lot of WordPress internal settings and plugin settings are stored in the options table. Values in this table take two forms: those which are autoloaded (which is the default) and those which are not. One of the first queries to the database that WordPress does once it starts loading a page, is the query that loads all options with autoload set to "yes". Hence, any call the an option after that, that happens on multiple pages, is weird. So when I saw this type of query happen a lot:</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> option_value <span style="color: #993333; font-weight: bold;">FROM</span> wp_options
  <span style="color: #993333; font-weight: bold;">WHERE</span> option_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'headspace_global'</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span></pre></div></div><p>I was wondering what was happening. It turned out that that headspace_global option simply didn't exist, so it can't be autoloaded. This wasn't happening with just this option, but with several options. The solution is pretty simple: just add the option as an empty option to your database. This might break some plugins though, and if it does, you should contact the plugin author...</p><p>This is actually something plugin authors have to take note of: doing a <code>get_option</code> to check whether a certain option is set or not, is actually more expensive than just setting the option and leaving it empty...</p><p>Adding an option to the database is done like this in your MySQL database:</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_options <span style="color: #66cc66;">&#40;</span> option_id<span style="color: #66cc66;">,</span> option_name<span style="color: #66cc66;">,</span> autoload<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'test'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'yes'</span><span style="color: #66cc66;">&#41;</span></pre></div></div><p>It should be noted that I've emailed John Godley, who has built and maintains <a
href="http://urbangiraffe.com/plugins/headspace2/">HeadSpace2</a>, and this'll be fixed in the next release.</p><h2>Non cached queries</h2><p>This happens, of course. If you see a certain query being performed more than once during the pageload, that's something to optimize. Check what is causing the queries, and then either solve them, or email the responsible plugin or theme author with what you've seen (be sure to copy <em>all</em> the queries you see).</p><h2>Checking whether the blog is installed</h2><p>The very first query WordPress does is a query to check whether the blog is installed, it's a pretty useless query if your blog is up and running, so I wanted to get rid of it. There's no pretty fix to this, so we'll do it in the not so pretty way:</p><ol><li>open up <em>wp-includes/functions.php</em></li><li>find the function <code>is_blog_installed()</code></li><li>add <code>return true;</code> as the first line of the function, and you're done!</li></ol><h2>"Heavy" plugins</h2><p>It turns out, that of the 16 queries my site now still does for a single post page, 7 are for the related posts plugin I'm using, <a
href="http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/">YARPP</a>, and if you're wondering: yes that's making me reconsider the plugin. I'm going to try a couple other plugins and see how good they do in both relevance and (database) performance.</p><h2>Your experiences with WordPress performance optimization?</h2><p>Have any experience in optimizing your WordPress performance by tweaking database calls yourself? Any cases I've missed? Let me know in the comments!!</p><p><a
href="http://yoast.com/wordpress-performance-optimization/">Optimizing WordPress database performance</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/wordpress-performance-optimization/feed/</wfw:commentRss> <slash:comments>71</slash:comments> </item> <item><title>New design (and submitting for a contest)!</title><link>http://yoast.com/new-design-and-submitting-for-a-contest/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=new-design-and-submitting-for-a-contest</link> <comments>http://yoast.com/new-design-and-submitting-for-a-contest/#comments</comments> <pubDate>Fri, 13 Mar 2009 07:32:24 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Offtopic]]></category> <category><![CDATA[Design]]></category> <category><![CDATA[RSS]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/new-design-and-submitting-for-a-contest/</guid> <description><![CDATA[<p>For all your lurkers in the RSS feed who haven't come out in the last week, and I know there's quite a few of you, there's a new design waiting for you if you click the link! I'm also, with this post, submitting this design to the WP WebHost Best WordPress Design Award contest in [...]</p><p><a
href="http://yoast.com/new-design-and-submitting-for-a-contest/">New design (and submitting for a contest)!</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><img
class="alignright" src="http://cdn.yoast.com/wp-content/uploads/2009/03/new-design-thumb.png" height="191" align="right" width="200" />For all your lurkers in the RSS feed who haven't come out in the last week, and I know there's quite a few of you, there's a new design waiting for you if you click the link!</p><p>I'm also, with this post, submitting this design to the <a
href="http://wpwebhost.com/best-wordpress-design-award/">WP WebHost Best WordPress Design Award</a> contest in the "Modern &amp; Elegant" category. I think the new design is worthy of a price :)</p><p>The credits for this design go to <a
href="http://www.w3-edge.com/">W3 Edge Web Site Design</a>, where Frederick and his team did an awesome job. Coding it took a fair bit longer than expected, mostly due to me being extremely busy with OrangeValley.</p><p><a
href="http://yoast.com/new-design-and-submitting-for-a-contest/">New design (and submitting for a contest)!</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/new-design-and-submitting-for-a-contest/feed/</wfw:commentRss> <slash:comments>35</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/03/new-design-thumb.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/03/new-design-thumb.png" medium="image" /> </item> <item><title>WestHost: WordPress hosting done right</title><link>http://yoast.com/westhost-wordpress-hosting/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=westhost-wordpress-hosting</link> <comments>http://yoast.com/westhost-wordpress-hosting/#comments</comments> <pubDate>Mon, 02 Mar 2009 09:16:26 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Hosting]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1402</guid> <description><![CDATA[<p>So in the last couple of weeks I had a bit of an issue with my server. Automatic plugin updates didn't work as I wanted them to, WP-Cron didn't work, and although I was able to fix all those I felt unhappy. I want my hosting party to take care of that stuff, and not [...]</p><p><a
href="http://yoast.com/westhost-wordpress-hosting/">WestHost: WordPress hosting done right</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>So in the last couple of weeks I had a bit of an issue with my server. <a
href="http://yoast.com/fix-automatic-plugin-update/">Automatic plugin updates</a> didn't work as I wanted them to, <a
href="http://yoast.com/wp-cron-issues/">WP-Cron didn't work</a>, and although I was able to fix all those I felt unhappy. I want my hosting party to take care of that stuff, and not think about it myself, so I started looking around. Turns out, WordPress hosting has become a fairly popular business.</p><p><a
class="clicky_log_outbound" href="http://yoast.com/out/westhost"><img
class="alignright" src="http://cdn.yoast.com/wp-content/uploads/2009/03/westhost-logo.png" alt="WestHost" width="250" height="73" /></a>I was checking the list of WordPress recommended hosting parties (you can find that <a
href="http://wordpress.org/hosting/">here</a>), and noticed one that I hadn't seen on there before, called <a
class="clicky_log_outbound" href="http://yoast.com/out/westhost">WestHost</a>. Turns out these guys were #1 most reliable hosting provider according to Netcraft four times in 2008, including November and December.</p><p>Their admins and support people also are top-notch (and all US based), I've never seen a migration handled as smoothly as they did. So, I can now honestly say I can recommend you to use <a
class="clicky_log_outbound" href="http://yoast.com/out/westhost">WestHost</a> for all your WordPress hosting needs, at $6.95 a month for their blog package, which even includes one free domain, they're not exactly what I'd call expensive either.</p><p>So, if you're wondering about which WordPress hosting package to go for, here's the answer: go for <a
class="clicky_log_outbound" href="http://yoast.com/out/westhost">WestHost</a>.</p><p><a
href="http://yoast.com/westhost-wordpress-hosting/">WestHost: WordPress hosting done right</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/westhost-wordpress-hosting/feed/</wfw:commentRss> <slash:comments>166</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/03/westhost-logo.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/03/westhost-logo.png" medium="image"> <media:title type="html">WestHost</media:title> </media:content> </item> <item><title>WordPress SEO Video</title><link>http://yoast.com/wordpress-seo-video/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-seo-video</link> <comments>http://yoast.com/wordpress-seo-video/#comments</comments> <pubDate>Tue, 27 Jan 2009 15:09:40 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[SEO]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[A4UExpo]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1354</guid> <description><![CDATA[<p>I spoke at A4UExpo London last year and will be speaking at the upcoming A4UExpo Amsterdam. One of the sessions I had in the last A4UExpo was the session on WordPress SEO &#38; Optimisation strategies. That entire session was taped, and the A4UExpo guys have been kind enough to allow me to embed it here [...]</p><p><a
href="http://yoast.com/wordpress-seo-video/">WordPress SEO Video</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>I spoke at <a
href="https://www.a4uexpo.com/london/">A4UExpo London</a> last year and will be speaking at the upcoming <a
href="https://www.a4uexpo.com/europe/">A4UExpo Amsterdam</a>. One of the sessions I had in the last A4UExpo was the session on WordPress SEO &amp; Optimisation strategies. That entire session was taped, and the A4UExpo guys have been kind enough to allow me to embed it here and show it to all of you, so, please, enjoy!</p><p>If you're more of a reader than a visual type, try my <a
href="http://yoast.com/articles/wordpress-seo/">article</a> on WordPress SEO.</p><p><a
href="http://yoast.com/wordpress-seo-video/"><em>Click here to view the embedded video.</em></a></p><h2>WordPress SEO slides</h2><p>Here are the slides that go with this presentation:</p> <object
width="562" height="461"><param
name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=wordpress-a4u-1224076887552338-8"/><param
name="allowFullScreen" value="true"/><param
name="allowScriptAccess" value="always"/><embed
src="http://static.slideshare.net/swf/ssplayer2.swf?doc=wordpress-a4u-1224076887552338-8"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="562" height="461"></embed></object><p><a
href="http://yoast.com/wordpress-seo-video/">WordPress SEO Video</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/wordpress-seo-video/feed/</wfw:commentRss> <slash:comments>85</slash:comments> <media:content  medium="video" duration="3133"> <media:player url="http://www.vimeo.com/moogaloop.swf?clip_id=5130637" /> <media:title type="html">WordPress SEO Video - Yoast - Tweaking Websites</media:title> <media:description type="html">I spoke at A4UExpo London last year and will be speaking at the upcoming A4UExpo Amsterdam. One of the sessions I had in the last A4UExpo was the session on WordPress SEO &#38;amp; Optimisation strategies. That entire session was taped, and the A4UExpo guys have been kind enough to allow me to embed it </media:description> <media:keywords>A4UExpo,WordPress Plugins,WordPress Themes,wordpress seo video,</media:keywords> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/06/wordpress-seo-video-yoast-tweaking-websites2.jpg"/> </media:content></item> <item><title>New layout, coming soon!</title><link>http://yoast.com/new-layout-coming-soon/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=new-layout-coming-soon</link> <comments>http://yoast.com/new-layout-coming-soon/#comments</comments> <pubDate>Mon, 12 Jan 2009 22:01:34 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1331</guid> <description><![CDATA[<p>So in between all the work on Tweetbacks, the new design for yoast.com is shaping up nicely. It's extremely funny, and I love it even when working with a bit longer. It's a whole lot lighter than the current one, which is a bit dark to my liking, and it's a lot more me. I've [...]</p><p><a
href="http://yoast.com/new-layout-coming-soon/">New layout, coming soon!</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast1.png" alt="design preview" class="alignright" />So in between all the work on <a
href="http://yoast.com/wordpress/tweetbacks/">Tweetbacks</a>, the new design for yoast.com is shaping up nicely. It's extremely funny, and I love it even when working with a bit longer. It's a whole lot lighter than the current one, which is a bit dark to my liking, and it's a lot more <em>me</em>.</p><p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast2.png" alt="design preview 2" class="alignleft" width="322" height="80" />I've outsourced it all this time. I had a designer do the new design, and had <a
href="http://psdtowordpress.com/">PSDtoWordPress.com</a> do the coding. I'll only have to touch it up a bit before release.</p><p><img
src="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast3.png" alt="design preview 3" class="alignright" width="269" height="70" />I'll be testing quite a bit, in line with all the new stuff I'm learning at <a
href="http://www.orangevalley.nl/">OrangeValley</a>, and to do that, I'm creating some new plugins, which I'll be releasing as well, probably on the OrangeValley site. For instance, I'm very curious if the new RSS buttons will convert, I might have to change that quite soon.</p><p>Watch this <a
href="http://yoast.com/feed/">blogs feed</a> and follow me on <a
href="http://twitter.com/jdevalk">Twitter</a>, the new layout should be done in about 48 to 72 hours!</p><p><a
href="http://yoast.com/new-layout-coming-soon/">New layout, coming soon!</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/new-layout-coming-soon/feed/</wfw:commentRss> <slash:comments>17</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast1.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast1.png" medium="image"> <media:title type="html">design preview</media:title> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast2.png" medium="image"> <media:title type="html">design preview 2</media:title> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2009/01/yoast3.png" medium="image"> <media:title type="html">design preview 3</media:title> </media:content> </item> <item><title>FeedBurner subscription show-off revisited</title><link>http://yoast.com/feedburner-subscription-feedproxy-google/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=feedburner-subscription-feedproxy-google</link> <comments>http://yoast.com/feedburner-subscription-feedproxy-google/#comments</comments> <pubDate>Sun, 21 Dec 2008 19:08:00 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Feedburner]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1311</guid> <description><![CDATA[<p>A couple of months back I blogged about how to show off your FeedBurner subscribers. In the comments then, a couple of people told me the code didn't work for them. After a few back and forths I found out those people were on FeedBurner's new servers, the Google ones. This new server actually has [...]</p><p><a
href="http://yoast.com/feedburner-subscription-feedproxy-google/">FeedBurner subscription show-off revisited</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>A couple of months back I blogged about how to <a
href="http://yoast.com/feedburner-subscriber-count/">show off your FeedBurner subscribers</a>. In the comments then, a couple of people told me the code didn't work for them. After a few back and forths I found out those people were on FeedBurner's new servers, the Google ones.</p><p>This new server actually has a new API Endpoint as well, and this endpoint brings along a bit of trouble. Google in all its wisdom decided to move the API onto HTTPS. Problem is, I was using Snoopy, which rocks, but doesn't work with HTTPS easily. It needs CURL for that, and if it needs CURL anyway, why not use the built-in PHP CURL. So, here's the code to use when you're on feedproxy (if this doesn't work for you, try the above linked older code):</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$url</span>	<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=joostdevalk&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ch</span> 	<span style="color: #339933;">=</span> curl_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
curl_setopt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
curl_setopt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> curl_exec<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
curl_close<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/circulation=\&quot;([0-9]+)\&quot;/'</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$fb</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fb</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastcheck'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	update_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;feedburnersubscribecount&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$fb</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">echo</span> <span style="color: #000088;">$fb</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' Subscribers can\'</span>t be wrong<span style="color: #339933;">!</span> Subscribe by <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://yoast.com/email-blog-updates/&quot;</span><span style="color: #339933;">&gt;</span>email<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> or to the <span style="color: #339933;">&lt;</span>a rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://feeds.feedburner.com/joostdevalk&quot;</span><span style="color: #339933;">&gt;</span>RSS feed<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> now<span style="color: #339933;">!</span><span style="color: #0000ff;">';</span></pre></div></div><p>Enjoy!</p><p><a
href="http://yoast.com/feedburner-subscription-feedproxy-google/">FeedBurner subscription show-off revisited</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/feedburner-subscription-feedproxy-google/feed/</wfw:commentRss> <slash:comments>22</slash:comments> </item> <item><title>Styling the intro paragraph</title><link>http://yoast.com/style-intro/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=style-intro</link> <comments>http://yoast.com/style-intro/#comments</comments> <pubDate>Sun, 21 Dec 2008 15:12:04 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1310</guid> <description><![CDATA[<p>A few weeks back (actually 18 days), @karelgeenen asked me on Twitter how he could bold the text above the &#60;!--more--&#62; tag in WordPress, like the Dutch site Marketingfacts (which is actually built in Expression Engine). I didn't know back then and this afternoon I decided to try and solve it for him. It turned [...]</p><p><a
href="http://yoast.com/style-intro/">Styling the intro paragraph</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>A few weeks back (actually 18 days), <a
href="http://twitter.com/karelgeenen">@karelgeenen</a> asked me on Twitter how he could bold the text above the &lt;!--more--&gt; tag in WordPress, like the Dutch site <a
href="http://www.marketingfacts.nl/">Marketingfacts</a> (which is actually built in Expression Engine).</p><p>I didn't know back then and this afternoon I decided to try and solve it for him. It turned out to be quite simple. I've made it into a simple plugin, called Yoast Style Intro, but you can also just add the code below to your themes <em>functions.php</em>.</p><p>The plugin wraps the intro in a span with <code>class="yoast_intro"</code>, so you can style it by adding, for instance, the following code to your themes <em>style.css</em>:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.yoast_intro</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><h2>The code</h2><p>Add this to your themes functions.php:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> yoast_style_intro<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;span class=&quot;yoast_intro&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span id=&quot;more'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/span&gt;&lt;span id=&quot;more'</span><span style="color: #339933;">,</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>			
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'yoast_style_intro'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>Or you can <a
href="http://cdn.yoast.com/wp-content/uploads/2008/12/style-intro.zip">download the plugin here</a>.</p><p>Be aware that if you use the filter <code>the_content</code> multiple times on a page, this plugin might give you trouble.</p><p><a
href="http://yoast.com/style-intro/">Styling the intro paragraph</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/style-intro/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>WP 2.7 fun: complete hcards</title><link>http://yoast.com/wp-complete-hcards/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wp-complete-hcards</link> <comments>http://yoast.com/wp-complete-hcards/#comments</comments> <pubDate>Fri, 12 Dec 2008 23:37:14 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=1304</guid> <description><![CDATA[<p>WordPress 2.7 has an awesome new thing: it turns the comments into hCards by default. An hCard is the microformat version of a vcard, which, with microformat extensions for your browser, you can then save the data of those commenters in your address book. For instance, with the Safari microformats plugin, this looks like this: [...]</p><p><a
href="http://yoast.com/wp-complete-hcards/">WP 2.7 fun: complete hcards</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>WordPress 2.7 has an awesome new thing: it turns the comments into <a
href="http://microformats.org/wiki/hcard">hCards</a> by default. An hCard is the microformat version of a vcard, which, with microformat extensions for your browser, you can then save the data of those commenters in your address book.</p><p>For instance, with the <a
href="http://zappatic.net/safarimicroformats/">Safari microformats plugin</a>, this looks like this:</p><p><img
class="aligncenter" src="http://cdn.yoast.com/wp-content/uploads/2008/12/microformat.png" alt="microformats in WordPress with Safari" width="580" height="459" /></p><p>If you use Firefox, you should check out <a
href="https://addons.mozilla.org/firefox/4106">Operator</a> for the same functionality.</p><p>The only issue is, that the hCards don't contain email addresses. This is obviously good, as you wouldn't want to share everyone's email addresses on your blog, but as an admin or editor, you'd love for those to be included by default right?</p><p>Well, (you've guessed it) I've written a small plugin that does just that. If you're allowed to edit the current post, and thus the comments, the email addresses will be added to the comments section, invisibly. If you use the hCard though, they're there, so you can directly save them to your address book. The record will then contain name, website, email address and photo (gravatar in most cases) for the user. Cool huh?</p><p>Download the plugin <a
href="http://cdn.yoast.com/wp-content/uploads/2008/12/complete-hcard.zip">here</a>.</p><p>To answer a question I've made a quick screencast:</p><p><a
href="http://yoast.com/wp-complete-hcards/"><em>Click here to view the embedded video.</em></a></p><p><a
href="http://yoast.com/wp-complete-hcards/">WP 2.7 fun: complete hcards</a> is a post from <a
href="http://yoast.com/about-me/">Joost de Valk</a>&#39;s <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/wp-complete-hcards/feed/</wfw:commentRss> <slash:comments>10</slash:comments> <media:content  medium="video" duration="49"> <media:player url="http://www.vimeo.com/moogaloop.swf?clip_id=2513893" /> <media:title type="html">WP 2.7 fun: complete hcards - Yoast - Tweaking Websites</media:title> <media:description type="html">WordPress 2.7 has an awesome new thing: it turns the comments into hCards by default. An hCard is the microformat version of a vcard, which, with microformat extensions for your browser, you can then save the data of those commenters in your address book. For instance, with the Safari microformats p</media:description> <media:keywords>WordPress Plugins,WordPress Themes,</media:keywords> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/06/wp-27-fun-complete-hcards-yoast-tweaking-websites2.jpg"/> </media:content><media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2008/12/microformat.png" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2008/12/microformat.png" medium="image"> <media:title type="html">microformats in WordPress with Safari</media:title> </media:content> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc (request URI is rejected)
Database Caching 12/47 queries in 0.027 seconds using apc
Content Delivery Network via cdn.yoast.com

Served from: yoast.com @ 2010-09-02 15:12:00 -->