<?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>Yoast &#187; WordPress Themes</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, 09 Feb 2012 13:22:13 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.4-alpha-19827</generator> <image><title>Yoast</title> <url>http://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><xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>WordPress SEO Plugin Theme Integration Guide</title><link>http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-seo-plugin-theme-integration-guide</link> <comments>http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#comments</comments> <pubDate>Sun, 01 Jan 2012 12:38:46 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress SEO]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=36589</guid> <description><![CDATA[<p>Theme authors come in two different shapes and sizes: those who integrate SEO "functionality" into their themes and those who don't. If you're in the camp of integrating SEO functionality into your theme, you've got yet another choice to make: do you "yield" for site owners that have an SEO plugin installed, disabling your own [...]</p><p><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/">WordPress SEO Plugin Theme Integration Guide</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>Theme authors come in two different shapes and sizes: those who integrate SEO "functionality" into their themes and those who don't. If you're in the camp of integrating SEO functionality into your theme, you've got yet another choice to make: do you "yield" for site owners that have an SEO plugin installed, disabling your own SEO functionality or do you deny them that choice.</p><p>For those who do decide to yield and for those who do not integrate SEO functionality into their theme, this is the guide to follow on how to make sure your theme works with all the major SEO plugins and more in particular, my <a
href="http://yoast.com/wordpress/seo/">WordPress SEO plugin</a>.</p><ol><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#basics">Basics</a></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#head">Head elements</a><ol><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#titles">Titles</a></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#meta">Meta's</a></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#link-items">Link items</a></li></ol></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#body">Body elements</a><ol><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#breadcrumbs">Breadcrumbs</a></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#other-body-elements">Other body elements</a></li></ol></li><li><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/#plugincheck">Is your WordPress SEO plugin active?</a></li></ol><h2 id="basics">Basics</h2><p>Whether or not your theme is in the WordPress.org repository, you should strive to meet their <a
href="http://codex.wordpress.org/Theme_Review">Theme Review guidelines</a>. With the <a
href="http://wordpress.org/extend/plugins/theme-check/">theme check</a> plugin you can simply check whether that's the case for most of the technical aspects. This makes sure you have all the necessary hooks for plugins to do their work. If any of those fail, fix them before even looking at the stuff below.</p><h2 id="head">Head elements</h2><h3 id="titles">Titles</h3><p>The most common issue with SEO plugins and WordPress themes is with titles: theme authors have a tendency to hardcode (sections of) titles into their themes, which results in hard to fix behavior, which I recently <a
href="http://yoast.com/wordpress-themes-page-title/">discussed here</a> and hasn't been fixed in WordPress core yet. In short, your title should be not even a tiny bit longer than this:</p><pre class="brush: php; html-script: true; light: true; title: ; notranslate">&lt;title&gt;&lt;?php wp_title(''); ?&gt;&lt;/title&gt;</pre><p>If you decide to embed SEO functionality in your theme, you should then put a filter function on to that <code>wp_title</code> functionality just like a plugin would. This allows you to "unhook" that filter when an SEO plugin is active.</p><h3 id="meta">Meta's</h3><p>Meta tags come in a vast amount of shapes and sizes, but there are only a few that "matter". There are the meta description, the meta keywords (<a
href="http://yoast.com/meta-keywords/">on which I have a strong opinion too</a>) and the meta robots tag. In my opinion, your theme should <em>never</em> embed any of these meta tags, but, if you decide to embed SEO functionality into your theme, write functions for these things and hook them on to the <code>wp_head</code> action.</p><p>Be very, very sure to allow for site owners to fully disable any meta functionality you write. I regularly, read: daily, advise people to change themes when their theme has a lot of SEO stuff embedded that is just plain wrong or collides with other plugins. Make no mistake: a portion of your users, probably a large portion of your users, cares about their SEO. Getting it <em>wrong</em> is worse then not doing anything, so if I were a theme author I'd most definitely opt for the latter.</p><h3 id="link-items">Link items</h3><p>There are a lot of &lt;link&gt; items that matter for SEO these days. There are <a
href="http://yoast.com/canonical-url-links/">rel=canonical</a>, <a
href="http://yoast.com/rel-next-prev-paginated-archives/">rel=next and rel=prev</a> and a few more. WordPress does rel=canonical on single posts and pages but nowhere else yet, though a <a
href="https://core.trac.wordpress.org/ticket/18660">patch for core is ready</a> to make WordPress add rel=canonical in more cases, but your theme should not do any of these. You're, to be honest, bound to get them wrong.</p><p>If you do decide to add them, do it in the same fashion as meta elements: hook them on to <code>wp_head</code> and make sure site owners can disable the functionality.</p><h2 id="body">Body elements</h2><h3 id="breadcrumbs">Breadcrumbs</h3><p>While the above points make integration for <em>any</em> SEO plugin easier, this point is more specific for my own WordPress SEO plugin. Integration of my breadcrumbs is quite easy, use something like the following code:</p><pre class="brush: php; title: ; notranslate">if ( function_exists('yoast_breadcrumb') ) {
   yoast_breadcrumb('&lt;div id=&quot;breadcrumbs&quot;&gt;','&lt;/div&gt;');
}</pre><p>This code will not display anything unless the breadcrumbs feature of my SEO plugin is enabled.</p><h4>Breadcrumbs Variables</h4><p>This breadcrumb path takes the following 3 variables:</p><p><strong><code>$prefix</code></strong><br
/> The code that your breadcrumb should be prefixed with. Default to an empty string.</p><p><strong><code>$suffix</code></strong><br
/> The code that should be added on the back of your breadcrumb. Default to an empty string.</p><p><strong><code>$display</code></strong><br
/> If set to false, will return the breadcrumb path instead of echo-ing it. Defaults to true.</p><h3 id="other-body-elements">Other body elements</h3><p>You should take note of my guides on <a
href="http://yoast.com/blog-headings-structure/">HTML heading structure</a> and <a
href="http://yoast.com/html-sitemap-wordpress/">HTML Sitemaps</a>. While my SEO plugin doesn't "interfere" with those, it's good practice to make them optimal. You should also read my <a
href="http://yoast.com/wordpress-seo-theme/">WordPress SEO Theme Guidelines</a> to make sure you're doing all the other necessary things.</p><h2 id="plugincheck">Is your WordPress SEO plugin active?</h2><p>You should check whether a constant named WPSEO_VERSION is defined, preferably like this:</p><pre class="brush: php; title: ; notranslate">if ( defined('WPSEO_VERSION') ) {
// Disable your SEO stuff
}</pre><p><a
href="http://yoast.com/wordpress-seo-plugin-theme-integration-guide/">WordPress SEO Plugin Theme Integration Guide</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-plugin-theme-integration-guide/feed/</wfw:commentRss> <slash:comments>43</slash:comments> </item> <item><title>rel=&#8221;author&#8221; and rel=&#8221;me&#8221; in WP and other platforms</title><link>http://yoast.com/wordpress-rel-author-rel-me/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-rel-author-rel-me</link> <comments>http://yoast.com/wordpress-rel-author-rel-me/#comments</comments> <pubDate>Tue, 23 Aug 2011 19:00:48 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[SEO]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Rich Snippets]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=6104</guid> <description><![CDATA[<p>The recent changes from Google and my post about it regarding the highlighting of authors in search caused quite a few questions. People have been asking me how to do specific things and how to make certain elements contain rel="author" or rel="me". Instead of replying to each of those emails and comments I decided to write one [...]</p><p><a
href="http://yoast.com/wordpress-rel-author-rel-me/">rel=&#8221;author&#8221; and rel=&#8221;me&#8221; in WP and other platforms</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>The recent changes from Google and my post about it regarding the <a
href="http://yoast.com/highlighting-wordpress-authors-search/">highlighting of authors in search</a> caused quite a few questions. People have been asking me how to do specific things and how to make certain elements contain rel="author" or rel="me". Instead of replying to each of those emails and comments I decided to write one post which "has it all".</p><p><strong>Update August 23rd, 2011:</strong> Google has made a simpler version available to those of you who are not able to follow the instructions below. It is still recommended that you <em>do </em>in fact follow the instructions below if you have the appropriate access to the blog you're trying to do this on, if not, please follow the instructions I added <a
href="#simplerversion">at the bottom</a> of this post. I also updated screenshots and added two video's with explanations. Let me know if you have more questions in the comments, I've updated the date of this post so it will pop up again in your reader.</p><p>I did see some more examples pop up, for example, when I searched for [<a
href="http://www.google.com/search?q=highlighting+authors&amp;pws=0" rel="nofollow">highlighting authors</a>], both this post from <a
href="http://www.mattcutts.com/blog/highlight-author-comments-wordpress/">Matt Cutts</a> (on highlighting authors in the comments) and this post from <a
href="http://smarterware.org/8291/8291">Gina Trapani</a> got an author highlight.</p><ol><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#link-google-profile">Is the link to the Google Profile from the author page required?</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#menu-item-rel-author">How to add rel="author" to a link in your menu</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#rel-me-bio">How to allow authors to add rel="me" to links in their bio's</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#google-profile-contactmethod">How to allow authors to set their Google Profile URL</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#change-author-url">How to change the author URL</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#simplerversion">Update: the simpler version</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#last-step">Last (but important!) step</a></li><li><a
href="http://yoast.com/wordpress-rel-author-rel-me/#example-result">rel="author" + rel="me" actually works!</a></li></ol><h2 id="link-google-profile">Is the link to the Google Profile from the author page required?</h2><p>Apparently, yes, it is. It's quite logical for Google to want a link from your Google profile to your author page, it makes 100% sure that you are indeed the author of that piece of content when you link <em>to</em> your Google Profile and back from your Google Profile to your author page. Of course the link to your Google Profile wouldn't be 100% needed for this, I don't know whether Google will keep this requirement.</p><p>The flow should thus be as follows: article links to author page <strong>on the same domain</strong>. The author page on the same domain <strong>links to the Google Profile</strong>. The Google profile, in turn, <strong>links back to the author page</strong>.</p><p>So you are <em>not</em>, as some people suggested, meant to link to your Google Profile straight from the article, instead, you should link to your author page on the domain you published the article at and that page in turn should link to your Google Profile and be linked <em>from</em> your Google Profile.</p><h2 id="menu-item-rel-author">How to add rel="author" to a link in your menu</h2><p>One of the issues that came up with is that some people don't want to show the author on each and every post when the author on that blog is always one single person. Those people will usually have an "about" page linked in their site's main navigation, for instance, Robert Scoble, on his blog Scobleizer:</p><p><img
class="size-full wp-image-6105 aligncenter" title="Scobleizer's about link, that should have rel=&quot;author&quot;" src="http://cdn.yoast.com/wp-content/uploads/2011/07/Scobleizer-about.jpg" alt="Scobleizer's about link, that should have rel=&quot;author&quot;" width="466" height="131" /></p><p>That "about" link could very easily be used to identify him as the author of each and every post, to Google, if it had <code>rel="author"</code> sticked to it. Turns out that this is actually very easy to do if you use the WordPress menu editor.</p><p>Go to the Menus page and in the top right, click on screen options:</p><p><img
class="size-full wp-image-6106 aligncenter" title="WordPress Screen Options Link" src="http://cdn2.yoast.com/wp-content/uploads/2011/07/screen-options-link.jpg" alt="WordPress Screen Options Link" width="312" height="116" /></p><p>Once you click that link, it'll fold out, and the display options will show, including "Link Relationship (XFN)", be sure to check that box:</p><p><img
class="alignnone size-full wp-image-6112" title="custom-menus-link-relationship-2" src="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menus-link-relationship-2.jpg" alt="" width="580" height="170" /></p><p>Once that box is checked, you can edit your menu item to include the link relationshop "author" which will cause it to get rel="author" added to it:</p><p><img
class="aligncenter size-full wp-image-6108" title="Custom Menu element" src="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menu-nav-item-link.jpg" alt="Custom Menu element, be sure to just add author, this will cause rel=author to be added to the link" width="424" height="255" />Be sure to just add "author" (without the quotes) this is enough to make sure the link will have rel="author" added to it.</p><h2 id="rel-me-bio">How to allow authors to add rel="me" to links in their bio's</h2><p>If you update your bio on a WordPress blog you write on to contain a link to your Google Profile and want to add <code>rel="me"</code>, you'll come to the conclusion that WordPress strips out all the <code>rel</code> elements from links. Why it does that is beyond me, I've already opened a <a
href="http://core.trac.wordpress.org/ticket/17977">Trac ticket</a> and created a patch to allow it. Until that is in core though (if it makes it in), you'll need to allow it yourself. To do that, simply add this to your site's <em>functions.php</em> file or functionality plugin:</p><pre class="brush: php; title: ; notranslate">function yoast_allow_rel() {
	global $allowedtags;
	$allowedtags['a']['rel'] = array ();
}
add_action( 'wp_loaded', 'yoast_allow_rel' );</pre><p>This will allow <em>all</em> rel values to be used, nofollow as well. You could tighten this more but I doubt you'll need it.</p><h2 id="google-profile-contactmethod">How to allow authors to set their Google Profile URL</h2><p>If you don't want authors to add the link to their bio but would rather give them an input field to enter their Google Profile URL, you'll need to hook into the <a
href="http://yoast.com/user-contact-fields-wp29/">contact methods functions</a> of WordPress. First, tell WordPress you want to add the Google Profile contact method:</p><pre class="brush: php; title: ; notranslate">function yoast_add_google_profile( $contactmethods ) {
	// Add Google Profiles
	$contactmethods['google_profile'] = 'Google Profile URL';
	return $contactmethods;
}
add_filter( 'user_contactmethods', 'yoast_add_google_profile', 10, 1);</pre><p>This will add an input field on their edit profile page below the default AIM, Yahoo and Google Talk / Jabber contact methods:</p><p><img
class="aligncenter size-full wp-image-6115" title="Google Profile URL input field" src="http://cdn2.yoast.com/wp-content/uploads/2011/07/google-profile-url-input.jpg" alt="Google Profile URL input field" width="552" height="288" /></p><p>Second, in your theme's <em>author.php</em> file, the author template, you need to add a bit of code to output this new URL:</p><pre class="brush: php; title: ; notranslate">$google_profile = get_the_author_meta( 'google_profile' );
if ( $google_profile ) {
	echo '&lt;a href=&quot;' . esc_url($google_profile) . '&quot; rel=&quot;me&quot;&gt;Google Profile&lt;/a&gt;';
}</pre><p>Of course you can style this in any way you want, show it in a list, etc. Here on yoast.com, for instance, I replaced the default contactmethods with Facebook, Twitter and the Google Profile.</p><h2 id="change-author-url">How to change the author URL</h2><p>If for one or more authors on your blog you want to change their default author URL, you could do something like this:</p><pre class="brush: php; title: ; notranslate">function yoast_change_author_link( $link, $author_id, $author ) {
  if ( 'admin' == $author )
    return 'http://example.com/about-me/';
  return $link;
}
add_filter( 'author_link', 'yoast_change_author_link', 10, 3 );</pre><p>This would change the author URL for the author with username "admin" to <code>http://example.com/about-me/</code>, you should of course change this to what you need in your specific case. This should work with most themes, if it doesn't with your theme, let me know what theme you're using and I'll try to come up with a solution.</p><h2>How can I test whether my rel="author" implementation works</h2><p>Once you've added one of this bits above, you probably want to test whether it's working. To do that, use Google's <a
href="http://www.google.com/webmasters/tools/richsnippets">Rich Snippets testing tool</a>. You can find an example report showing that my implementation is correct <a
href="http://www.google.com/webmasters/tools/richsnippets?url=http://yoast.com/highlighting-wordpress-authors-search/">here</a>. See the screenshot:</p><p><img
class="alignright size-full wp-image-7534" title="rich-snippets-test-1" src="http://cdn3.yoast.com/wp-content/uploads/2011/07/rich-snippets-test-1.png" alt="" width="580" height="384" /></p><p>Now don't forget to take the last step, keep on reading below the simple version!!</p><h2>An explanation video from Google</h2><p>After this post Google's Matt Cutts and Othar Hansson did a video on the topic, feel free to watch it here:</p><p><object
width="580" height="351"><param
name="movie" value="http://www.youtube.com/v/FgFb6Y-UJUI?version=3"></param><param
name="allowFullScreen" value="true"></param><param
name="allowscriptaccess" value="always"></param><embed
src="http://www.youtube.com/v/FgFb6Y-UJUI?version=3" type="application/x-shockwave-flash" width="580" height="351" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><h2 id="simplerversion">Update: the simpler version</h2><p>Because not everyone either has the technical knowledge and/or the actual access to their sites to be able to accomplish the above, Google has made a simpler alternative. I don't know whether this alternative will work forever, it does work now though. It's quite simple, just follow these steps:</p><ol><li>Find your Google Profile URL, copy paste it.</li><li>Create a link with that profile URL, and add this ?rel=author to the end of the URL.</li><li>As an anchor text, use your full name with a +, in my case the anchor text would be: +Joost de Valk</li><li>Go to the last step, below the video embedded below.</li></ol><p>The full HTML of my profile link would look like this (line break just to make it easier to read, you shouldn't have that):</p><pre class="brush: xml; title: ; notranslate">&lt;a href=&quot;https://plus.google.com/115369062315673853712
/about?rel=author&quot;&gt;+Joost de Valk&lt;/a&gt;</pre><p>Of course, there's a video explaining this version too:</p><p><object
width="580" height="351"><param
name="movie" value="http://www.youtube.com/v/gG3Oh7Ues8A?version=3"></param><param
name="allowFullScreen" value="true"></param><param
name="allowscriptaccess" value="always"></param><embed
src="http://www.youtube.com/v/gG3Oh7Ues8A?version=3" type="application/x-shockwave-flash" width="580" height="351" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><h2 id="last-step">Last (but important!) step</h2><p>Whichever version of the code you used, be sure to submit your details through <a
href="https://spreadsheets.google.com/spreadsheet/viewform?formkey=dHdCLVRwcTlvOWFKQXhNbEgtbE10QVE6MQ">this form</a>. You probably won't get an email back but at some point it (might) suddenly start working!</p><h2 id="example-result">rel="author" + rel="me" actually works!</h2><p>To show that the markup above works (I use the complete version, not the simple version):</p><p><a
class="thickbox" href="http://cdn3.yoast.com/wp-content/uploads/2011/07/relme-relauthor-search-google.png"><img
class="alignright size-large wp-image-7532" title="rel=me / rel=author search in Google showing my author highlight" src="http://cdn.yoast.com/wp-content/uploads/2011/07/relme-relauthor-search-google-590x59.png" alt="rel=me / rel=author search in Google showing my author highlight" width="580" height="58" /></a></p><p><a
href="http://yoast.com/wordpress-rel-author-rel-me/">rel=&#8221;author&#8221; and rel=&#8221;me&#8221; in WP and other platforms</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-rel-author-rel-me/feed/</wfw:commentRss> <slash:comments>127</slash:comments> <media:content url="http://www.youtube-nocookie.com/v/gG3Oh7Ues8A" duration="239"> <media:player url="http://www.youtube-nocookie.com/v/gG3Oh7Ues8A" /> <media:title type="html">rel=&#34;author&#34; and rel=&#34;me&#34; in WP and other platforms &#8226; Yoast</media:title> <media:description type="html">Google highlights authors in search when markup is done correctly: using rel=&#34;author&#34; to the author page and rel=&#34;me&#34; to the Google Profile.</media:description> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2012/01/relauthor-and-relme-in-wp-and-other-platforms-8226-yoast-300x225.jpg" /> <media:keywords>Google,Rich Snippets,WordPress Themes,rel author</media:keywords> </media:content> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/07/Scobleizer-about-125x125.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/07/Scobleizer-about.jpg" medium="image"> <media:title type="html">Scobleizer&#8217;s about link, that should have rel=&#8221;author&#8221;</media:title> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/07/Scobleizer-about-125x125.jpg" /> </media:content> <media:content url="http://cdn2.yoast.com/wp-content/uploads/2011/07/screen-options-link.jpg" medium="image"> <media:title type="html">WordPress Screen Options Link</media:title> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/07/screen-options-link-125x116.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menus-link-relationship-2.jpg" medium="image"> <media:title type="html">custom-menus-link-relationship-2</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menus-link-relationship-2-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menu-nav-item-link.jpg" medium="image"> <media:title type="html">Custom Menu element</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2011/07/custom-menu-nav-item-link-125x125.jpg" /> </media:content> <media:content url="http://cdn2.yoast.com/wp-content/uploads/2011/07/google-profile-url-input.jpg" medium="image"> <media:title type="html">Google Profile URL input field</media:title> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/07/google-profile-url-input-125x125.jpg" /> </media:content> <media:content url="http://cdn3.yoast.com/wp-content/uploads/2011/07/rich-snippets-test-1.png" medium="image"> <media:title type="html">rich-snippets-test-1</media:title> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2011/07/rich-snippets-test-1-125x125.png" /> </media:content> <media:content url="http://cdn3.yoast.com/wp-content/uploads/2011/07/relme-relauthor-search-google.png" medium="image"> <media:title type="html">rel=me / rel=author search in Google showing my author highlight</media:title> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/07/relme-relauthor-search-google-125x75.png" /> </media:content> </item> <item><title>Highlighting WordPress authors in search</title><link>http://yoast.com/highlighting-wordpress-authors-search/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=highlighting-wordpress-authors-search</link> <comments>http://yoast.com/highlighting-wordpress-authors-search/#comments</comments> <pubDate>Thu, 30 Jun 2011 12:03:09 +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=6066</guid> <description><![CDATA[<p>Amidst all the news about Google+ and Google social interaction tracking (and yes I will work on &#38; post about that too), Google released some other news today. They said they're going to be highlighting authors in the search results.  I think this is an awesome feature. It means that you'll see a picture / avatar [...]</p><p><a
href="http://yoast.com/highlighting-wordpress-authors-search/">Highlighting WordPress authors in search</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>Amidst all the news about <a
href="http://www.google.com/+/learnmore/">Google+</a> and <a
href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSocial.html">Google social interaction tracking</a> (and yes I will work on &amp; post about that too), Google released some other news today. They said they're going to be <a
href="http://insidesearch.blogspot.com/2011/06/highlighting-content-creators-in-search.html">highlighting authors</a> in the search results.  I think this is an awesome feature. It means that you'll see a picture / avatar of the author appear next to a search result, another way to highlight your search results and increase your Click Through Rate if you've build up credibility.</p><p>For instance, if I search for Danny Sullivan's blog "daggle", the results now look like this:</p><p><a
class="thickbox" href="http://cdn.yoast.com/wp-content/uploads/2011/06/daggle-Google-Search.jpg"><img
class="size-large wp-image-6067 alignnone" title="daggle - Google Search" src="http://cdn2.yoast.com/wp-content/uploads/2011/06/daggle-Google-Search-590x144.jpg" alt="daggle - Google Search" width="580" height="141" /></a></p><p>This potentially has some nice side effects and I'm very curious how this will pan out. If they're going to show this in normal search results next to blog posts, which they say in their post that they will, more credible authors will get more clicks, independent of whether they rank better. This in turn allows Google to create a sort of "author trust rank". You see, when they show a picture of you next to your blog and you get more clicks than they'd expect because of that, you obviously have a higher credibility.</p><p>If it all works out like that, this might just be the last step some of those web journalists out there need to finally be able to demand the rockstar salaries they deserve!</p><h2>I want those author highlights too!</h2><p>To do this, you need to apply the <a
href="http://insidesearch.blogspot.com/2011/06/authorship-markup-and-web-search.html">authorship markup</a> Google announced a couple weeks back. This basically means adding <code>rel="author"</code> to a link to the authors page <em>on the same domain</em>. My author link for this post, for instance, looks like this:</p><pre class="brush: xml; title: ; notranslate">&lt;a rel=&quot;author&quot; href=&quot;http://yoast.com/author/admin/&quot;
  title=&quot;Posts by Joost de Valk&quot;&gt;Joost de Valk&lt;/a&gt;</pre><p>This code is generated by the WordPress core function <code>the_author_posts_link()</code>. When Google announced the authorship markup, I immediately created a <a
href="http://core.trac.wordpress.org/ticket/17722">trac ticket</a> and patch for WordPress core to add <code>rel="author"</code> to both that function, and to all the places in both TwentyTen and TwentyEleven where it should appear and where those themes didn't use that core function.</p><p>This patch has already been committed and will make its debut in WordPress 3.2. If you're not running WordPress 3.2 beta yet but really do want this functionality, you can use the following snippet, just copy paste it into your (child-)theme's <em>functions.php</em> file:</p><pre class="brush: php; title: ; notranslate">function yoast_rel_author_filter( $link ) {
	if ( false === strpos( $link, 'rel=&quot;author&quot;' ) )
		$link = str_replace ( '&lt;a ', '&lt;a rel=&quot;author&quot; ', $link );
	return $link;
}
add_filter('the_author_posts_link','yoast_rel_author_filter',10,1);</pre><p>This won't break your theme when you upgrade to 3.2, although by that time it's safe to remove it.</p><h2>Note for theme Theme authors</h2><p>This upgrade makes it even more important then before to have a link to the author's posts page / profile page underneath each post. Hence, with that, the importance of an authors page rises as well. You should allow authors to write a short bio, show off a picture (their gravatar?), and link to some other places like their Twitter, Facebook and Google Profile.</p><p>Luckily, this was made easy back with the release of WordPress 2.9, when <a
href="http://yoast.com/user-contact-fields-wp29/">user contact fields</a> became filterable.</p><h2>But that's not all!</h2><p>As the <a
href="http://www.google.com/support/webmasters/bin/answer.py?answer=1229920&amp;hl=en">help center article</a> states, your posts and articles need to link to your profile page on that same site. Your Google Profile, in turn, needs to link back to that author page. So go and add the link of your author page to your <a
href="https://plus.google.com/">Google+ Profile</a>.</p><p><a
href="http://yoast.com/highlighting-wordpress-authors-search/">Highlighting WordPress authors in search</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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/highlighting-wordpress-authors-search/feed/</wfw:commentRss> <slash:comments>30</slash:comments> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/06/daggle-Google-Search-125x125.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/06/daggle-Google-Search.jpg" medium="image"> <media:title type="html">daggle &#8211; Google Search</media:title> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/06/daggle-Google-Search-125x125.jpg" /> </media:content> </item> <item><title>Custom Post Type Snippets to make you smile</title><link>http://yoast.com/custom-post-type-snippets/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=custom-post-type-snippets</link> <comments>http://yoast.com/custom-post-type-snippets/#comments</comments> <pubDate>Fri, 17 Jun 2011 13:49:58 +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=4817</guid> <description><![CDATA[<p>So it's friday, I've been coding all day and I thought I'd share some of the cool snippets I've come across and/or developed today. I've mostly been working with Custom Post Types and Taxonomies, so let me share some of that goodness. Let's geek out in a bit, but first let me show you why [...]</p><p><a
href="http://yoast.com/custom-post-type-snippets/">Custom Post Type Snippets to make you smile</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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 it's friday, I've been coding all day and I thought I'd share some of the cool snippets I've come across and/or developed today. I've mostly been working with Custom Post Types and Taxonomies, so let me share some of that goodness. Let's geek out in a bit, but first let me show you why this is cool, be sure to click the image, so you can see which functionality I've added to the otherwise boring custom posts overview screen:</p><div
id="attachment_4860" class="wp-caption aligncenter" style="width: 590px"><a
class="thickbox" href="http://cdn2.yoast.com/wp-content/uploads/2011/06/404-Errors.png"><img
src="http://cdn2.yoast.com/wp-content/uploads/2011/06/404-Errors-590x148.png" alt="Custom Post Type goodness" title="Custom Post Type goodness" width="580" height="145" class="size-large wp-image-4860" /></a><p
class="wp-caption-text">Click for large version</p></div><h2>Add columns to the overview page for a Custom Post Type</h2><p>So you'll want to add some columns to your post type's overview page, or remove some. Don't forget to replace &lt;CPT&gt; with your own custom post type in all these examples:</p><pre class="brush: php; title: ; notranslate">// Change the columns for the edit CPT screen
function change_columns( $cols ) {
  $cols = array(
    'cb'       =&gt; '&lt;input type=&quot;checkbox&quot; /&gt;',
    'url'      =&gt; __( 'URL',      'trans' ),
    'referrer' =&gt; __( 'Referrer', 'trans' ),
    'host'     =&gt; __( 'Host', 'trans' ),
  );
  return $cols;
}
add_filter( &quot;manage_&lt;CPT&gt;_posts_columns&quot;, &quot;change_columns&quot; );</pre><p>Be sure to always leave the <code>cb</code> column in there or your mass edit / delete functionality will not work.</p><h2>Give these new columns some content</h2><p>Now let's fill these new columns with some content from the custom post type:</p><pre class="brush: php; title: ; notranslate">function custom_columns( $column, $post_id ) {
  switch ( $column ) {
    case &quot;url&quot;:
      $url = get_post_meta( $post_id, 'url', true);
      echo '&lt;a href=&quot;' . $url . '&quot;&gt;' . $url. '&lt;/a&gt;';
      break;
    case &quot;referrer&quot;:
      $refer = get_post_meta( $post_id, 'referrer', true);
      echo '&lt;a href=&quot;' . $refer . '&quot;&gt;' . $refer. '&lt;/a&gt;';
      break;
    case &quot;host&quot;:
      echo get_post_meta( $post_id, 'host', true);
      break;
  }
}

add_action( &quot;manage_posts_custom_column&quot;, &quot;custom_columns&quot;, 10, 2 );</pre><h2>Make these new columns sortable</h2><p>Now this extra info is cool, I bet you want to sort by it, that's as simple as this:</p><pre class="brush: php; title: ; notranslate">// Make these columns sortable
function sortable_columns() {
  return array(
    'url'      =&gt; 'url',
    'referrer' =&gt; 'referrer',
    'host'     =&gt; 'host'
  );
}

add_filter( &quot;manage_edit-&lt;CPT&gt;_sortable_columns&quot;, &quot;sortable_columns&quot; );</pre><h2>Filter Custom Posts by Custom Taxonomy</h2><p>Ok so far this is all fairly simple. Now let's go a bit more advanced. Let's say you have a custom taxonomy attached to that custom post type and you want to show a filter for that custom taxonomy on the custom post types overview page, just like you have a categories drop down on the posts overview page. This code was taken (though slightly modified) from <a
href="http://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type">this thread</a>.</p><p>Let's first add that dropdown / select box to the interface:</p><pre class="brush: php; title: ; notranslate">// Filter the request to just give posts for the given taxonomy, if applicable.
function taxonomy_filter_restrict_manage_posts() {
    global $typenow;

    // If you only want this to work for your specific post type,
    // check for that $type here and then return.
    // This function, if unmodified, will add the dropdown for each
    // post type / taxonomy combination.

    $post_types = get_post_types( array( '_builtin' =&gt; false ) );

    if ( in_array( $typenow, $post_types ) ) {
    	$filters = get_object_taxonomies( $typenow );

        foreach ( $filters as $tax_slug ) {
            $tax_obj = get_taxonomy( $tax_slug );
            wp_dropdown_categories( array(
                'show_option_all' =&gt; __('Show All '.$tax_obj-&gt;label ),
                'taxonomy' 	  =&gt; $tax_slug,
                'name' 		  =&gt; $tax_obj-&gt;name,
                'orderby' 	  =&gt; 'name',
                'selected' 	  =&gt; $_GET[$tax_slug],
                'hierarchical' 	  =&gt; $tax_obj-&gt;hierarchical,
                'show_count' 	  =&gt; false,
                'hide_empty' 	  =&gt; true
            ) );
        }
    }
}

add_action( 'restrict_manage_posts', 'taxonomy_filter_restrict_manage_posts' );</pre><p>And then, we add a filter to the query so the dropdown will actually work:</p><pre class="brush: php; title: ; notranslate">function taxonomy_filter_post_type_request( $query ) {
  global $pagenow, $typenow;

  if ( 'edit.php' == $pagenow ) {
    $filters = get_object_taxonomies( $typenow );
    foreach ( $filters as $tax_slug ) {
      $var = &amp;$query-&gt;query_vars[$tax_slug];
      if ( isset( $var ) ) {
        $term = get_term_by( 'id', $var, $tax_slug );
        $var = $term-&gt;slug;
      }
    }
  }
}

add_filter( 'parse_query', 'taxonomy_filter_post_type_request' );</pre><p>Note that for these last two snippets to work, <code>query_var</code> must have been set to true when registering the custom taxonomy, otherwise this'll never work.</p><h2>Bonus: Add Custom Post Type to feed</h2><p>This one came courtesy of Remkus de Vries a while back and was helpful today, adding a custom post type to your site's main feed, don't forget to replace &lt;CPT&gt; with your own custom post type:</p><pre class="brush: php; title: ; notranslate">// Add a Custom Post Type to a feed
function add_cpt_to_feed( $qv ) {
  if ( isset($qv['feed']) &amp;&amp; !isset($qv['post_type']) )
    $qv['post_type'] = array('post', '&lt;CPT&gt;');
  return $qv;
}

add_filter( 'request', 'add_cpt_to_feed' );</pre><p><a
href="http://yoast.com/custom-post-type-snippets/">Custom Post Type Snippets to make you smile</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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/custom-post-type-snippets/feed/</wfw:commentRss> <slash:comments>20</slash:comments> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/06/404-Errors-125x125.png" /> <media:content url="http://cdn2.yoast.com/wp-content/uploads/2011/06/404-Errors.png" medium="image"> <media:title type="html">Custom Post Type goodness</media:title> <media:description type="html">Click for large version</media:description> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/06/404-Errors-125x125.png" /> </media:content> </item> <item><title>WordPress template part: a powerful tool</title><link>http://yoast.com/wordpress-template-part/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-template-part</link> <comments>http://yoast.com/wordpress-template-part/#comments</comments> <pubDate>Thu, 26 May 2011 13:00:10 +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=4318</guid> <description><![CDATA[<p>Now that I'm working with custom post types a bit more on this site, for my plugin reviews and speaking agenda, for instance, I'm also starting to appreciate the power of the WordPress template part functionality a whole lot more, which was introduced in WordPress 3.0. Let me explain how I use it and how [...]</p><p><a
href="http://yoast.com/wordpress-template-part/">WordPress template part: a powerful tool</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>Now that I'm working with custom post types a bit more on this site, for my <a
title="WordPress plugin reviews" href="http://yoast.com/wp-plugin-review/">plugin reviews</a> and <a
href="http://yoast.com/speaks-at/">speaking agenda</a>, for instance, I'm also starting to appreciate the power of the WordPress template part functionality a whole lot more, which was introduced in WordPress 3.0. Let me explain how I use it and how I think you should use it.</p><p>My whole loop for taxonomy archives, other archive pages <em>and</em> search results now just looks like this:</p><pre class="brush: php; title: ; notranslate">while ( have_posts() ) : the_post();
  get_template_part( '/partials/excerpt' , $post-&gt;post_type );
endwhile;</pre><p>As you can see, I get the post type for the current post and then use that to load the template part that will display that post type. For each different post type I have created a snippet that displays that post type in it's own specific way, a plugin review would have a rating attached to it, a speaking event would be marked up as an hCalendar event and so forth.</p><p>Let's say the post type is <code>speaking_event</code>. The above code would try to load, from my theme's directory, the file <em>/partials/excerpt-speaking_event.php</em>. If that file doesn't exist, it would load <em>/partials/excert.php</em>. So if I create a new custom post type, it will fall back to the "default" display of a post, which is in <em>excerpt.php</em>, and if I decide to give it another look, it will get it's own "short" WordPress template part.</p><p>Of course, as this loop itself is referenced about 15 times on all the different forms of archive templates I have, it in itself is a template simply called 'loop'. The best thing about this is that now, when you search for something that results in showing several post types, or you have a taxonomy attached to several post types, they're all displayed in their own specific way. See an example of that below:</p><p
style="text-align: center;"><a
href="http://cdn3.yoast.com/wp-content/uploads/2011/05/wordpress-post-formats.png"><img
class="size-medium wp-image-4321 aligncenter" title="WordPress template part in action" src="http://cdn2.yoast.com/wp-content/uploads/2011/05/wordpress-post-formats-300x273.png" alt="WordPress template part in action" width="300" height="273" /></a></p><h2>More WordPress template part ideas?</h2><p>Now I'd love to know whether you are using a WordPress template part in your theme and if so, how and where, please share in the comments so we can build a "gallery" of WordPress template part ideas!</p><p><a
href="http://yoast.com/wordpress-template-part/">WordPress template part: a powerful tool</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-template-part/feed/</wfw:commentRss> <slash:comments>15</slash:comments> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/05/wordpress-post-formats-125x125.png" /> <media:content url="http://cdn3.yoast.com/wp-content/uploads/2011/05/wordpress-post-formats.png" medium="image"> <media:title type="html">WordPress template part in action</media:title> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/05/wordpress-post-formats-125x125.png" /> </media:content> </item> <item><title>WordPress editor style</title><link>http://yoast.com/wordpress-editor-style/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-editor-style</link> <comments>http://yoast.com/wordpress-editor-style/#comments</comments> <pubDate>Wed, 25 May 2011 12:57:56 +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=4277</guid> <description><![CDATA[<p>I'm writing this with a WordPress editor style CSS active, for the first time. This feature has been available in WordPress since WordPress 3.0 but I had not used it until now, which is nothing but stupid. A WordPress editor style makes the TinyMCE editor used in visual editing mode look like your theme, using [...]</p><p><a
href="http://yoast.com/wordpress-editor-style/">WordPress editor style</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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'm writing this with a WordPress editor style CSS active, for the first time. This feature has been available in WordPress since WordPress 3.0 but I had not used it until now, which is nothing but stupid. A WordPress editor style makes the TinyMCE editor used in visual editing mode look like your theme, using the font, color, width etc. This allows for even better formatting of your text while you're writing it.</p><p>Check out what my <a
href="http://yoast.com/articles/wordpress-hosting/">WordPress hosting</a> article looks like in my visual editor now that I have an editor stylesheet active, for instance:</p><div
id="attachment_4280" class="wp-caption aligncenter" style="width: 310px"><a
class="thickbox" href="http://cdn2.yoast.com/wp-content/uploads/2011/05/wordpress-hosting-with-editor-style.png"><img
class="size-medium wp-image-4280" title="WordPress hosting article with WordPress editor style" src="http://cdn.yoast.com/wp-content/uploads/2011/05/wordpress-hosting-with-editor-style-300x143.png" alt="WordPress hosting article with WordPress editor style" width="300" height="143" /></a><p
class="wp-caption-text">WordPress hosting article with WordPress editor style</p></div><p>This makes it easier for editors to write content in such a way that it fits neatly on the page.</p><h2>Creating a WordPress editor style CSS file</h2><p>Creating a WordPress editor style CSS file is a pretty easy process, just follow these steps:</p><ol><li>Start by creating a file called <em>editor-style.css </em>in your WordPress theme's root directory.</li><li>Open up your theme's <em>functions.php </em>file and add the following line of code in the setup code, or just at the top: <code>add_editor_style();</code>.</li><li>Now start editing your newly created editor CSS file. Port over the CSS from your theme's <em>style.css</em> that affects the styling of everything in your post's body. Be sure to assign the width, text color, background color etc. of the content part of your theme to the <code>body</code> in your <em>editor-style.css</em> file.</li><li>If it's not working as you expected, check the editor-style.css file from TwentyTen or TwentyEleven and see how they apply the several styles.</li><li>Don't forget to add the image styles like <code>.alignleft</code>, <code>.alignright</code> and <code>.aligncenter</code> as well as <code>blockquote</code> etc.</li></ol><div>Once you've created your WordPress editor style CSS, start writing a new post and you'll love how you can now enjoy the visual editor even more.</div><p><a
href="http://yoast.com/wordpress-editor-style/">WordPress editor style</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-editor-style/feed/</wfw:commentRss> <slash:comments>25</slash:comments> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/05/wordpress-hosting-with-editor-style-125x125.png" /> <media:content url="http://cdn2.yoast.com/wp-content/uploads/2011/05/wordpress-hosting-with-editor-style.png" medium="image"> <media:title type="html">WordPress hosting article with WordPress editor style</media:title> <media:description type="html">WordPress hosting article with WordPress editor style</media:description> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/05/wordpress-hosting-with-editor-style-125x125.png" /> </media:content> </item> <item><title>Turn your commenters into subscribers!</title><link>http://yoast.com/comment-email-subscription-form/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comment-email-subscription-form</link> <comments>http://yoast.com/comment-email-subscription-form/#comments</comments> <pubDate>Mon, 31 Jan 2011 20:34:30 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Email]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=3806</guid> <description><![CDATA[<p>Only a small percentage of your visitors leave a comment. This group of people is probably also interested in subscribing to your newsletter, if you have one. So I created a method to add a "subscribe to my WordPress newsletter" checkbox to my comment form a couple of weeks ago. The result? 40 new subscribers [...]</p><p><a
href="http://yoast.com/comment-email-subscription-form/">Turn your commenters into subscribers!</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>Only a small percentage of your visitors leave a comment. This group of people is probably also interested in subscribing to your newsletter, if you have one. So I created a method to add a "subscribe to my <a
href="http://yoast.com/wordpress-newsletter/">WordPress newsletter</a>" checkbox to my comment form a couple of weeks ago. The result? 40 new subscribers in less than 2 weeks. That's over 1,000 new subscribers each year if it continues to grow in this fashion.</p><p>This isn't for the faint of heart, if you're not a programmer this might be a bit tough to do, but I'll outline how it works:</p><h2>Adding a comment meta value</h2><p>Using the reasonably new comment_meta API, we're gonna add a piece of data to comments, that stores whether people want to subscribe to the newsletter or not. I did that by adding the following function to my <em>functions.php</em> file:</p><pre class="brush: php; title: ; notranslate">function ymc_add_meta_settings($comment_id) {
  add_comment_meta(
    $comment_id,
    'mailchimp_subscribe',
    $_POST['mailchimp_subscribe'],
    true
  );
}
add_action ('comment_post', 'ymc_add_meta_settings', 1);</pre><h2>Add a checkbox to the comment form</h2><p>That wasn't too hard yet right? Next we add the checkbox to the comment form, wherever that is located in your theme, it's just plain (X)HTML:</p><pre class="brush: php; html-script: true; title: ; notranslate">&lt;input type=&quot;checkbox&quot; name=&quot;mailchimp_subscribe&quot;
  id=&quot;mailchimp_subscribe&quot;/&gt;
&lt;label for=&quot;mailchimp_subscribe&quot;&gt;
  Subscribe to Yoast WordPress Newsletter (weekly email)
&lt;/label&gt;</pre><h2>Subscribe the commenter</h2><p>That's not really rocket science either. The next step is to take this data and work it. What we'll do is use the Mailchimp API to automatically subscribe people, and send them a confirmation email (we still need to make sure they double-opt-in).</p><p>First, let's grab the comment:</p><pre class="brush: php; title: ; notranslate">function ymc_subscription_add( $cid, $comment ) {
  $cid = (int) $cid;

  if ( !is_object($comment) )
    $comment = get_comment($cid);

  if ( $comment-&gt;comment_karma == 0 ) {
    // DO WORK
  }
}
add_action('comment_approved_','ymc_subscription_add',10,1);
add_action('comment_post', 'ymc_subscription_add', 60,1);</pre><p>The code above makes sure we only do anything with comments that have been approved. So if a comment is approved as spam, it gets ignored. It also makes sure the <code>$comment</code> variable is filled with the comment. Now once we've done this, we're going to check whether the commenter wanted to be subscribed to the newsletter, so within the DO WORK section above, we add this:</p><pre class="brush: php; title: ; notranslate">$subscribe = get_comment_meta($cid, 'mailchimp_subscribe', true);
if ( $subscribe == 'on' ) {
  // DO WORK
}</pre><p>We're checking for "on" because that's how PHP stores a checked checkbox, and this way we can reuse the <code>$subscribe</code> variable later. Once we're sure the commenter wanted to be subscribed, let's get all the data we need to add a subscriber to our mailing list. To do that, we'll need to know:</p><ul><li>Our <a
href="http://admin.mailchimp.com/account/api">Mailchimp API key</a></li><li>Our <a
href="http://www.mailchimp.com/api/1.3/#overview_description">Mailchimp API endpoint server</a></li><li>The <a
href="http://www.mailchimp.com/kb/article/how-can-i-find-my-list-id">Mailchimp list ID</a> for the list you want to add the commenter to</li></ul><p>Once you've got these three, we can create the post request:</p><pre class="brush: php; title: ; notranslate">$apikey   = ' &lt;your API key&gt; ';
$listid   = ' &lt;List ID&gt; ';
$endpoint   = 'http://&lt;your endpoint&gt;.api.mailchimp.com/1.3/?output=php';

$request   = array(
  'apikey' =&gt; $apikey,
  'id' =&gt; $listid,
  'email_address' =&gt; strtolower( $comment-&gt;comment_author_email ),
  'double_optin' =&gt; true,
  'merge_vars' =&gt; array(
    ' &lt;merge tag for name&gt; ' =&gt; $comment-&gt;comment_author,
    'OPTIN_IP' =&gt; $comment-&gt;comment_author_IP,
  )
);
$result = wp_remote_post(
  $endpoint.'&amp;method=listSubscribe',
  array( 'body' =&gt; json_encode($request) )
);</pre><p>Note: setting double_option to false would forego the sending of an opt-in email, thereby immediately subscribing people to the list. Do not do this as it is illegal in most parts of Europe <em>and</em> in the US to do so.</p><p>As you can see, we're using the WP_HTTP wrapper function <code>wp_remote_post</code> to handle the post. At this time I'm not actually doing anything with the result, because I'm a sloppy coder. You should of course check the result and based on that do the following action:</p><pre class="brush: php; title: ; notranslate">update_comment_meta($cid, 'mailchimp_subscribe', 'subscribed', 'on');</pre><p>This will prevent the code from trying to subscribe someone multiple times and overloading the MailChimp API.</p><h2>Conclusion: Subscribe those commenters!</h2><p>People are interacting with your site already, they're already giving you their email address, have them check that box, and make them subscribe to your list. I personally think it's a great enhancement that would make a lot of people happy. If you're not using Mailchimp but another email provider and are capable to do the same stuff with their API: please post about it, drop a comment here and I'll add a link!</p><p><em>Disclosure</em>: Mailchimp sponsors my newsletter and is a regular advertiser on my sites.</p><p><a
href="http://yoast.com/comment-email-subscription-form/">Turn your commenters into subscribers!</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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/comment-email-subscription-form/feed/</wfw:commentRss> <slash:comments>64</slash:comments> </item> <item><title>The anatomy of a WordPress theme</title><link>http://yoast.com/wordpress-theme-anatomy/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-theme-anatomy</link> <comments>http://yoast.com/wordpress-theme-anatomy/#comments</comments> <pubDate>Mon, 10 Jan 2011 15:07:16 +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=3742</guid> <description><![CDATA[<p>With all the WordPress theme frameworks that arose over the past few years, you'd almost forget what a normal WordPress theme looks like. Almost, because Yoast has got your back and we're about to remind you! Check out our anatomy of a WordPress theme infographic: For reference, here is the copy in the infographic: Anatomy of a WordPress [...]</p><p><a
href="http://yoast.com/wordpress-theme-anatomy/">The anatomy of a WordPress theme</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>With all the WordPress theme frameworks that arose over the past few years, you'd almost forget what a normal WordPress theme looks like. Almost, because Yoast has got your back and we're about to remind you! Check out our anatomy of a WordPress theme infographic:</p><p><img
class="aligncenter size-full wp-image-3743" title="Anatomy of a WordPress theme - Infographic" src="http://cdn2.yoast.com/wp-content/uploads/2011/01/anatomy-wordpress-yoast.png" alt="Anatomy of a WordPress theme - Infographic" width="570" height="3045" /></p><p>For reference, here is the copy in the infographic:</p><h2>Anatomy of a WordPress theme</h2><h3>The cheatsheet for how your blog works</h3><p>WordPress themes are made up of a folder of template files, each of which controls a specific piece of your theme. Parts of your site that remain static no matter what page you're on are controlled by header, sidebar and footer files. You can hack these files so they detect what page you are on and serve different content accordingly, such as display different navigation on posts than on pages; however it is most common for these sections to look the same throughout the site.</p><ul><li><strong>header.php</strong><br
/> Global file that displays headers and navigation. Also contains HTML code.</li><li><strong>The Loop</strong><br
/> The display of contents of the main area of your site are controlled by individual WordPress theme template files using what's called "the loop".</li><li><strong>sidebar.php</strong><br
/> Sidebar display is controlled in this file. Multiple sidebars can be set up in functions.php, and contents of sidebar widgets are set up from the WordPress wp-admin panel.</li><li><strong>footer.php</strong><br
/> Contains instructions for global footer and closes HTML tags.</li></ul><h3>index.php - home</h3><p>The index file controls what the homepage of your WordPress theme looks like. By default it is a loop that queries and then displays the most recent blog posts, with a link in the bottom to view previous posts.</p><p>Alternately, you can specify in wp-admin -&gt; settings -&gt; reading to have the home page be a page you created yourself in WordPress. In that case, you specify a different page/URL for the regular blog posts to appear on, and that page is generated by index.php.</p><h3>single.php - individual posts</h3><p>The display of individual posts in your WordPress theme is controlled by a little file called single.php. It contains a loop that queries just one post and displays it.</p><p>You can specify if you want sidebars (and which you want), if you want it to look different than the other pages on the site.</p><h3>page.php - individual pages</h3><p>Page.php controls what pages look like. You can choose to eliminate sidebars or other elements, add other unique elements for pages alone.</p><p>WordPress also allows you to create different page templates within your WordPress theme for different types of pages. To create a page template, simply copy page.php, rename it to whatever you want, then add this code to the top:</p><pre class="brush: php; title: ; notranslate">&amp;lt;?php
/*
Template Name: YourPageNameHere
*/
?&amp;gt;</pre><h3>archive.php, category.php, tag.php - archives</h3><p>You can control the look and feel of different archives using template files also. If there is no archive file, the archives will look like index.php; however you can create an archive.php to override that. If you create a file called category.php, it will override archive.php for categories only. If you create a tag.php, you can override it for tag archives only.</p><h2>The Loop</h2><p>The loop is perhaps the most powerful part of your WordPress theme. It starts with a query (which determines which posts or pages to grab), and ends with a PHP "endwhile" statement. Everything in between is up to you. You can specify the output of titles, post content, metadata, custom fields and commenting all within the loop and each element is output for each post or page until the query is done. You can set up multiple loops and queries on a single page; for example: on a single.php you could have the loop showing the entire content of a single post, with a loop outputting just titles and thumbnails for related posts below it.</p><ul><li>Query post or page</li><li>Start Loop</li><li><code>the_title</code> (outputs the title of the post)</li><li><code>the_excerpt</code> (outputs the post excerpt)</li><li><code>the_content</code> (outputs the full post content)</li><li><code>the_category</code> (outputs the post categories)</li><li><code>the_author</code> (outputs the post author)</li><li><code>the_date</code> (outputs the post date)</li><li>other tags (there is a variety of other tags you can use in the loop)</li><li><code>endwhile;</code></li><li>Exit the loop</li></ul><h2>Background files of a WordPress theme</h2><p>In order for a WordPress theme to work, it needs a few essential background files. These files can be modified to your needs and can quite powerfully affect the custom look and functionality of your site.</p><h3>comments.php</h3><p>This controls the output of comments, which can be included in the loop if you desire comments on your theme. Comments.php can be overriden by plugins such as Disqus, which then take over comment functionality on your blog.</p><h3>functions.php</h3><p>Functions.php allows you to put your own custom PHP code in order to modify core elements of your theme. It is often used to specify multiple sidebars, change the number of characters in the excerpt or add custom admin panel options for wp-admin.</p><h3>style.css</h3><p>This is the main CSS stylesheet for your theme. It also contains text at the top which tells WordPress what the name of your WordPress theme is, who the author is and what the URL of your site is.</p><p>This infographic was created in collaboration with the artists of <a
href="http://www.creditloan.com">CreditLoan.com</a>.</p><p><a
href="http://yoast.com/wordpress-theme-anatomy/">The anatomy of a WordPress theme</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-theme-anatomy/feed/</wfw:commentRss> <slash:comments>117</slash:comments> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/01/anatomy-wordpress-yoast-125x125.png" /> <media:content url="http://cdn2.yoast.com/wp-content/uploads/2011/01/anatomy-wordpress-yoast.png" medium="image"> <media:title type="html">Anatomy of WordPress theme &#8211; Yoast</media:title> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2011/01/anatomy-wordpress-yoast-125x125.png" /> </media:content> </item> <item><title>How to reduce HTTP requests for your WordPress site</title><link>http://yoast.com/reduce-http-requests-wordpress/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reduce-http-requests-wordpress</link> <comments>http://yoast.com/reduce-http-requests-wordpress/#comments</comments> <pubDate>Sat, 01 Jan 2011 20:12:06 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress development]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Themes]]></category><guid
isPermaLink="false">http://yoast.com/?p=3662</guid> <description><![CDATA[<p>The web is sort of a reversed highway: you get tickets for going too slow and bonus points for speeding. Whether you're "just" a blogger or you have an e-commerce site, your site needs to be fast. We've written about what to do to speed up Magento before, and I've mentioned caching for WordPress more [...]</p><p><a
href="http://yoast.com/reduce-http-requests-wordpress/">How to reduce HTTP requests for your WordPress site</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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-3669" title="High Speed Websites" src="http://cdn.yoast.com/wp-content/uploads/2011/01/high-speed-road.jpg" alt="High Speed Websites" width="250" height="167" />The web is sort of a reversed highway: you get tickets for going too slow and bonus points for speeding. Whether you're "just" a blogger or you have an e-commerce site, your site <em>needs</em> to be fast. We've written about <a
href="http://yoast.com/magento-performance-hosting/">what to do to speed up Magento</a> before, and I've mentioned caching for WordPress more than once, but there's more.</p><p>One of the things I notice very often when performing a <a
href="http://yoast.com/hire-me/site-analysis/">site analysis</a> is that sites are loading way too much external files. Reducing the number of files needed to load your site, thereby reducing the number of HTTP requests, makes your site load faster. Faster loading sites have a better user experience, and it's also a <a
href="http://yoast.com/site-speed-ranking-factor/">ranking factor</a> these days. So, it's clear, when you can, you should reduce the number of HTTP requests.</p><p>There's usually three parts to this play:</p><ul><li>Reduce the number of JavaScript files</li><li>Reduce the number of CSS files</li><li>Reduce the number of images</li></ul><p>Luckily, <a
href="http://yoast.com/author/frederick/">Frederick</a> has made a large portion of this very easy in W3 Total Cache, allowing us to tackle 1 &amp; 2 in one fell swoop. But first, let me give you a brief intro into "browser pipelining".</p><h2>Browser pipelining and why reducing HTTP requests helps</h2><p>If you web page consists of a HTML file, 3 CSS files, 5 JavaScript files and 10 images, a reasonable amount, it requires a total of 19 files to be loaded. Originally, browsers would load these one after the other. These days, most browsers will download 4 to 8 files at the same time, this is called "<a
href="http://www.mozilla.org/projects/netlib/http/pipelining-faq.html">pipelining</a>". If we take a maximum of 8 requests (which is pretty high) to the same domain at the same time, it would still require 3 batches to load.</p><p>Especially for CSS files and JavaScript files that are loaded in the <code>&lt;head&gt;</code> section of your site, that's an issue: the browser can't start rendering until it has all the files that "block" it from rendering. So we actually need to do two things: combine these files and reduce the number of requests and then move all the files that shouldn't be blocking the page load out of the <code>&lt;head&gt;</code> section and into the body.</p><p>This means that for instance a JavaScript that adds some minor functionality to your site's footer could <em>easily</em> be loaded in the last bit of your HTML, so it doesn't block a browser from starting to render your page. This doesn't impact your <em>actual</em> load time, but it does highly impact your <em>perceived</em> load time.</p><p>Reducing the number of files to load <em>does</em> help your actual load time: it makes your site faster.</p><h2>Reducing number of javascript &amp; CSS files loaded</h2><p>Install <a
href="http://yoast.com/w3-total-cache/">W3 Total Cache</a>, and then go to the "Minify" page in it settings screen. On there, scroll down a bit, and you should see two sections "JavaScript" and, right below it, "Cascading Style Sheets". In there, you can add your respective JS and CSS files, it'll look something like this:</p><p><img
class="aligncenter size-full wp-image-3663" title="JavaScript Minification W3TC" src="http://cdn.yoast.com/wp-content/uploads/2011/01/javascript-minif-w3tc.jpg" alt="JavaScript Minification in W3 Total Cache" width="600" height="250" /></p><p>If you've added all your CSS and JS file, W3TC will combine these files into one and minify them, meaning it will remove comments, spacing and other unneeded stuff. So you could have 5 js files and combine them into one, effectively saving 4 HTTP requests. As you can see, this is not hard to do, so there's really no excuse for not doing it.</p><h2>Reducing the number of images</h2><p>If you have a complicated theme, your theme might be using a lot of background images. I know this site does. There's a way to make all these images load as one file though, through a process called CSS spriting. Explaining the full process and history is too long a story for this post, if you're interested, <a
href="http://www.alistapart.com/articles/sprites" rel="external">this article on A List Apart</a> is very good read.</p><p>In short: all those background images are combined into one background image. For example, see one of the sprites on my site (click for full version):</p><p><a
class="aligncenter thickbox" href="http://cdn.yoast.com/wp-content/themes/yoast-v3/img/main-sprite-2.png"><img
src="http://cdn.yoast.com/wp-content/themes/yoast-v3/img/main-sprite-2.png" alt="Main sprite for Yoast.com" /></a></p><p>Now this isn't an easy thing to do, and if you're no developer you should really hire one to do this for you. If you know a thing or two about development, you might find <a
href="http://spriteme.org/">SpriteMe</a>, a service / bookmarklet by Steve Souders a <em>very</em> useful tool.</p><p>Another nice step is to prevent images that are not currently visible to the visitor of your website (because they're below his / her fold, or in web designer speak "outside the viewport") from loading. A jQuery plugin called <a
href="http://www.appelsiini.net/projects/lazyload">Lazy Load</a> will help you do this, it'll automatically load images as the visitor scrolls down and the images are visible to him.</p><h2>Bonus tip: use a CDN</h2><p>One of the reasons my site is so fast is because I have not only made a sprite out of all those images, they're actually loaded from a Content Delivery Network, or CDN. A CDN is a group of servers around the world, optimized for fast delivery of static files and positioned to be as close as possible to your site's visitors.</p><p>The benefit from this is twofold: first of all, as said, those servers are faster and closer to your visitors. Second, they're also usually on another host, like <em>cdn.yoast.com</em> in my own example. This means your browser will open 8 requests to yoast.com <em>and</em> 8 requests to cdn.yoast.com at the same time. Allowing it to load even more at the same time. The smart among you will now think: "hey, what if I would use 2 hostnames for my CDN, or 3". Good thinking. W3 Total Cache has full support for that too, in fact, it makes using a CDN ridiculously easy.</p><p>I use the <a
href="http://yoast.com/out/cdn" rel="nofollow">Level3 CDN</a> (aff), provided by VPS.net, which has been very good for me the last few months and is reasonably priced.</p><h2>Conclusion: reduce those HTTP requests</h2><p>As you can see, some of these steps are pretty easy. That means there's no good excuse for you not to take them. Just do it, make your site faster and your visitors happier!</p><p><small>Photo from <a
href="http://www.shutterstock.com/">Shutterstock</a>.</small></p><p><a
href="http://yoast.com/reduce-http-requests-wordpress/">How to reduce HTTP requests for your WordPress site</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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/reduce-http-requests-wordpress/feed/</wfw:commentRss> <slash:comments>41</slash:comments> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/01/high-speed-road-125x125.jpg" /> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/01/high-speed-road.jpg" medium="image"> <media:title type="html">High Speed Websites</media:title> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/01/high-speed-road-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/uploads/2011/01/javascript-minif-w3tc.jpg" medium="image"> <media:title type="html">JavaScript Minification W3TC</media:title> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2011/01/javascript-minif-w3tc-125x125.jpg" /> </media:content> <media:content url="http://cdn.yoast.com/wp-content/themes/yoast-v3/img/main-sprite-2.png" medium="image"> <media:title type="html">Main sprite for Yoast.com</media:title> </media:content> </item> <item><title>Quick WP Tip: paths and URLs in WordPress</title><link>http://yoast.com/paths-urls-wordpress/#utm_source=rss&#038;utm_medium=rss&#038;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: That annoyed me, [...]</p><p><a
href="http://yoast.com/paths-urls-wordpress/">Quick WP Tip: paths and URLs in WordPress</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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><pre class="brush: php; title: ; notranslate">define(
  'MY_WORDPRESS_FOLDER',
  $_SERVER['DOCUMENT_ROOT']  
);  
define(  
  'MY_THEME_FOLDER',  
  str_replace(&quot;&quot;,'/',dirname(__FILE__))  
);  
define(  
  'MY_THEME_PATH',  
  '/' . substr(  
    MY_THEME_FOLDER,  
    stripos(MY_THEME_FOLDER,'wp-content')  
  )  
);</pre><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 class="brush: plain; title: ; notranslate">/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 class="brush: plain; title: ; notranslate">/wp-content/themes/example-theme</pre></li><li>The stylesheet is now included with the following path:<pre class="brush: plain; title: ; notranslate">/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 class="brush: plain; title: ; notranslate">/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><pre class="brush: php; title: ; notranslate">wp_enqueue_style(
    'my_meta_css',
     get_template_directory_uri(). '/custom/book_panel.css'
  );</pre><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 WP Tip: paths and URLs in WordPress</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>8</slash:comments> </item> <item><title>Why functionality in themes is not always good.</title><link>http://yoast.com/theme-functionality-issues/#utm_source=rss&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn3.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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>35</slash:comments> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2010/08/frustration1-125x125.jpg" /> <media:content url="http://cdn3.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>Implementing hreview in your WordPress theme</title><link>http://yoast.com/implement-hreview-wordpress-theme/#utm_source=rss&#038;utm_medium=rss&#038;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[Microformats]]></category> <category><![CDATA[Quix]]></category> <category><![CDATA[Rich Snippets]]></category> <category><![CDATA[WordPress optimization]]></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 get Rich Snippets showing for your site and 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 [...]</p><p><a
href="http://yoast.com/implement-hreview-wordpress-theme/">Implementing hreview in your WordPress theme</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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 get Rich Snippets showing for your site and 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 just do a tutorial on how I implemented <code>hreview</code> in my theme.</p><h2 id="activate">How I "activate" a hReview</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://cdn2.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://cdn2.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><pre class="brush: php; title: ; notranslate">function hreview_echo($val) {
  global $post;
  $rating = get_post_meta($post-&gt;ID, 'rating', true);
  if ($rating) {
    echo $val;
  }
}</pre><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><pre class="brush: php; html-script: true; light: true; title: ; notranslate">&lt;div &lt;?php post_class() ?&gt; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;</pre><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><pre class="brush: php; title: ; notranslate">function hreview_post_class($classes, $class, $post_id) {
  global $post;
  $review = get_post_meta($post-&gt;ID, 'rating', true);
  if ($review) {
    $classes[] = 'hreview';
  }
  return $classes;
}
add_filter('post_class','hreview_post_class',10,3);</pre><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><pre class="brush: php; light: true; title: ; notranslate">&lt;div class=&quot;post&quot;&gt;</pre><p>You can just use our <code>hreview_echo()</code> function:</p><pre class="brush: php; light: true; title: ; notranslate">&lt;div class=&quot;post&lt;?php hreview_echo(' hreview'); ?&gt;&quot;&gt;</pre><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><pre class="brush: php; light: true; title: ; notranslate">&lt;h1&gt;&lt;?php the_title();?&gt;&lt;/h1&gt;</pre><p>This is easily turned into the following, again using the <code>hreview_echo</code> function we created before:</p><pre class="brush: php; light: true; title: ; notranslate">&lt;h1 &lt;?php hreview_echo(' class=&quot;item fn&quot;'); ?&gt;&gt;&lt;?php the_title();?&gt;&lt;/h1&gt;</pre><h2 id="date">The date of the hReview</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><pre class="brush: php; light: true; title: ; notranslate">&lt;span class=&quot;date&quot;&gt;&lt;?php the_time('d F Y');?&gt;&lt;/span&gt;</pre><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><pre class="brush: php; html-script: true; title: ; notranslate">&lt;span class=&quot;date&lt;?php hreview_echo(' dtreviewed') ?&gt;&quot;&gt;
  &lt;?php
      hreview_echo('&lt;span class=&quot;value-title&quot; title=&quot;'.
        get_the_time('Y-m-d').'&quot;/&gt;');
      the_time('d F Y');
  ?&gt;
&lt;/span&gt;</pre><p>This outputs:</p><pre class="brush: php; html-script: true; title: ; notranslate">&lt;span class=&quot;date dtreviewed&quot;&gt;
  &lt;span class=&quot;value-title&quot; title=&quot;2010-02-10&quot;/&gt;
  10 February 2010
&lt;/span&gt;</pre><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><pre class="brush: php; light: true; title: ; notranslate">&lt;span class=&quot;author&quot;&gt;&lt;?php the_author(); ?&gt;&lt;/span&gt;</pre><p>Now you'll get by now what we'll do:</p><pre class="brush: php; html-script: true; title: ; notranslate">&lt;span class=&quot;author&lt;?php hreview_echo(' reviewer'); ?&gt;&quot;&gt;
  &lt;?php the_author(); ?&gt;
&lt;/span&gt;</pre><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><pre class="brush: xml; light: true; title: ; notranslate">&lt;div class=&quot;entry&quot;&gt;</pre><p>You've guessed it by now haven't you? Here we go:</p><pre class="brush: php; html-script: true; light: true; title: ; notranslate">&lt;div class=&quot;entry&lt;?php hreview_echo(' description'); ?&gt;&quot;&gt;</pre><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><pre class="brush: php; html-script: true; light: true; title: ; notranslate">&lt;div class=&quot;entry&lt;?php hreview_echo(' summary'); ?&gt;&quot;&gt;</pre><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><pre class="brush: php; html-script: true; title: ; notranslate">&lt;div class=&quot;rating&quot;&gt;My rating:&lt;/div&gt;
&lt;div title=&quot;4.5 out of 5 stars&quot; class=&quot;rating_bar&quot;&gt;
  &lt;div style=&quot;width:90%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre><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><pre class="brush: css; title: ; notranslate">.rating {
  float: left;
  margin-right: 10px;
}
.rating_bar {
  float: left;
  width: 55px;
  background: url(images/stars.gif) 0 0 repeat-x;
}
.rating_bar div {
  height: 12px;
  background: url(images/stars.gif) 0 -13px repeat-x;
}</pre><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><pre class="brush: php; title: ; notranslate">&lt;?php
function display_hreview_rating() {
  global $post;
  $rating = get_post_meta($post-&gt;ID, 'rating', true);
  if ($rating) {
?&gt;
    &lt;div class=&quot;rating&quot;&gt;
      My rating:
      &lt;span class=&quot;value-title&quot; title=&quot;&lt;?php echo $rating; ?&gt;&quot;/&gt;
    &lt;/span&gt;&lt;/div&gt;
    &lt;div title=&quot;&lt;?php echo $rating; ?&gt; out of 5 stars&quot; class=&quot;rating_bar&quot;&gt;
      &lt;div style=&quot;width:&lt;?php echo ($rating*20); ?&gt;%&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;?php
  }
  return $output;
}
?&gt;</pre><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 &amp; rich snippets</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://cdn2.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><pre class="brush: php; html-script: true; light: true; title: ; notranslate">this plugin is completely &lt;span class=&quot;pricerange&quot;&gt;free&lt;/span&gt;</pre><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 on Rich Snippets</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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn2.yoast.com/wp-content/uploads/2010/02/rating-custom-field-125x125.jpg" /> <media:content url="http://cdn2.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://cdn2.yoast.com/wp-content/uploads/2010/02/rating-custom-field-125x125.jpg" /> </media:content> <media:content url="http://cdn2.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://cdn3.yoast.com/wp-content/uploads/2010/02/rich-snippet-125x89.jpg" /> </media:content> </item> <item><title>Practical Guide to creating a 404 Error Page for WordPress</title><link>http://yoast.com/404-error-pages-wordpress/#utm_source=rss&#038;utm_medium=rss&#038;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]]></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 error page needs to offer a solution. In [...]</p><p><a
href="http://yoast.com/404-error-pages-wordpress/">Practical Guide to creating a 404 Error Page for WordPress</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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 error page needs to offer a solution.</em></strong></p><p><img
class="alignright size-full wp-image-1744" title="Crossing out problems and instead offering solutions for your 404 error page" src="http://cdn.yoast.com/wp-content/uploads/2009/11/problems-solutions.jpg" alt="Crossing out problems and instead offering solutions for your 404 error page" width="250" height="166" />In the default WordPress Kubrick theme the 404 error page (<a
class="thickbox" title="Kubrick 404 - Ugly as hell" rel="404s" href="http://cdn2.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 error 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 error 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 error 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 error 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 error page for WordPress</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 error pages:</p><div
style="width: 425px; height: 130px; margin: 0 auto;"><a
class="thickbox" title="Apple's 404 page" rel="404-inspire" href="http://cdn2.yoast.com/wp-content/uploads/2009/10/apple-404.png"><img
class="alignleft size-thumbnail wp-image-1648" src="http://cdn.yoast.com/wp-content/uploads/2009/10/apple-404-125x125.png" alt="Apple 404 error page" width="125" height="125" /></a><a
class="thickbox" title="IBM's 404 page" rel="404-inspire" href="http://cdn.yoast.com/wp-content/uploads/2009/10/ibm-404.png"><img
class="alignleft size-thumbnail wp-image-1650" src="http://cdn3.yoast.com/wp-content/uploads/2009/10/ibm-404-125x125.png" alt="ibm 404 error page" width="125" height="125" /></a><a
class="thickbox" title="Conversion Rate Experts 404 page" rel="404-inspire" href="http://cdn.yoast.com/wp-content/uploads/2009/11/cre.png"><img
class="alignleft size-thumbnail wp-image-1699" src="http://cdn3.yoast.com/wp-content/uploads/2009/11/cre-125x125.png" alt="Conversion Rate Experts 404 error page" width="125" height="125" /></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 error 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
class="alignleft size-full wp-image-1729" title="404-error" src="http://cdn3.yoast.com/wp-content/uploads/2009/11/404-error.jpg" alt="404-error" width="250" height="134" />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-&gt;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><pre class="brush: php; title: ; notranslate">$s = $wp_query-&gt;query_vars['name'];
$s = preg_replace(&quot;/(.*)-(html|htm|php|asp|aspx)$/&quot;,&quot;$1&quot;,$s);
$posts = query_posts( array( 'post_type' =&gt; 'any', 'name' =&gt; $s) );</pre><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><pre class="brush: php; title: ; notranslate">$s = str_replace(&quot;-&quot;,&quot; &quot;,$s);
if (count($posts) == 0) {
  $posts = query_posts(array( array('post_type' =&gt; 'any', 'name' =&gt; $s) );
}</pre><p>Now we have an array with posts, at least, we hope we do, so let's check that, and loop through it:</p><pre class="brush: php; title: ; notranslate">if (count($posts) &gt; 0) {
  echo &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;;
  echo &quot;&lt;ul&gt;&quot;;
  foreach ($posts as $post) {
    echo '&lt;li&gt;';
    echo '&lt;a href=&quot;'.get_permalink($post-&gt;ID).'&quot;&gt;'.$post-&gt;post_title.'&lt;/a&gt;';
    echo '&lt;/li&gt;';
  }
  echo &quot;&lt;/ul&gt;&quot;;
}</pre><p>I've made an adapted version of the Kubrick 404 error page, which you can <a
id="kubrick404" href="http://cdn3.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 error 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://cdn2.yoast.com/wp-content/uploads/2009/11/google-crawl-errors.png"><img
class="aligncenter size-medium wp-image-1707" title="google-crawl-errors" src="http://cdn3.yoast.com/wp-content/uploads/2009/11/google-crawl-errors-300x215.png" alt="google-crawl-errors" width="300" height="215" /></a></p><h2>Two Things you Need to Know about 404 error 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 error page on your WordPress blog or anywhere else, 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 error pages in this post.</p><p><a
href="http://yoast.com/404-error-pages-wordpress/">Practical Guide to creating a 404 Error Page for WordPress</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn2.yoast.com/wp-content/uploads/2009/11/problems-solutions-125x125.jpg" /> </media:content> <media:content url="http://cdn2.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://cdn3.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://cdn3.yoast.com/wp-content/uploads/2009/11/cre-125x125.png" /> </media:content> <media:content url="http://cdn3.yoast.com/wp-content/uploads/2009/11/404-error.jpg" medium="image"> <media:title type="html">404-error</media:title> <media:thumbnail url="http://cdn3.yoast.com/wp-content/uploads/2009/11/404-error-125x125.jpg" /> </media:content> <media:content url="http://cdn2.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://cdn3.yoast.com/wp-content/uploads/2009/11/google-crawl-errors-125x125.png" /> </media:content> </item> <item><title>Quick WP Tip: Conditional Thickbox loading</title><link>http://yoast.com/conditional-thickbox-loading/#utm_source=rss&#038;utm_medium=rss&#038;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: Conditional Thickbox loading</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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><pre class="brush: php; title: ; notranslate">function yst_conditional_thickbox() {
  global $post;
  if (is_singular() &amp;&amp;
    strpos($post-&gt;post_content,'class=&quot;thickbox&quot;') !== false) {
      wp_enqueue_script('thickbox');
      wp_enqueue_style('thickbox');
  }
}
add_action('wp_print_styles','yst_conditional_thickbox');</pre><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: Conditional Thickbox loading</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn.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://cdn.yoast.com/screenshots/debug-theme-2-20091014-150235.png">these</a> <a
class="thickbox"  rel="gallery-debug-theme"  href="http://cdn.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://cdn.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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn3.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://cdn3.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&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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><pre class="brush: php; title: ; notranslate">function previous_posts_link_class() {
  return 'class=&quot;previouspostslink&quot;';
}
add_filter('previous_posts_link_attributes','previous_posts_link_class');

function next_posts_link_class() {
  return 'class=&quot;nextpostslink&quot;';
}
add_filter('next_posts_link_attributes','next_posts_link_class');</pre><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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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://cdn2.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><pre class="brush: php; title: ; notranslate">$wp_locale-&amp;gt;weekday[0] = __('Sunday','orangevalley');</pre><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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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>51</slash:comments> <media:thumbnail url="http://cdn2.yoast.com/wp-content/uploads/2009/07/lang-select.jpg" /> <media:content url="http://cdn2.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&#038;utm_medium=rss&#038;utm_campaign=remove-smilies-wordpress</link> <comments>http://yoast.com/remove-smilies-wordpress/#comments</comments> <pubDate>Mon, 13 Jul 2009 11:29:19 +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=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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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><pre class="brush: php; title: ; notranslate">function yst_remove_smileys($bool) {
  return false;
}
add_filter('option_use_smilies','yst_remove_smileys',99,1);</pre><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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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
title="Genesis" href="http://yoast.com/wp-theme/genesis/">Genesis</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&amp;s=books&amp;qid=1246561087&amp;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><a
href="http://yoast.com/on-the-gpl-themes-plugins-free/">On the GPL, Themes, Plugins &#038; Free.</a> is a post by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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&#038;utm_medium=rss&#038;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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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 &amp; 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 by <a
rel="author" href="http://yoast.com/author/admin/">Joost de Valk</a> on <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> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 15/119 queries in 0.031 seconds using apc
Object Caching 5362/5584 objects using apc
Content Delivery Network via cdn.yoast.com

Served from: yoast.com @ 2012-02-10 02:23:00 -->
