<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>WpRecipes.com</title>
	
	<link>http://www.wprecipes.com</link>
	<description>Daily recipes to cook with WordPress</description>
	<lastBuildDate>Tue, 21 May 2013 15:55:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Wprecipes" /><feedburner:info uri="wprecipes" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Wprecipes</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>How to add nofollow attributes to all links in a specific category</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/li9E5gSdHXY/how-to-add-nofollow-attributes-to-all-links-in-a-specific-category</link>
		<comments>http://www.wprecipes.com/how-to-add-nofollow-attributes-to-all-links-in-a-specific-category#comments</comments>
		<pubDate>Tue, 21 May 2013 15:55:08 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[link]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3575</guid>
		<description><![CDATA[Sometimes you may want to have an entire category of your blog with nofollow links, for exemple if you're linking to a lot of external resources. Here is a quick and easy recipe to do so. Enjoy!]]></description>
				<content:encoded><![CDATA[<p>Simply copy the code below and paste it on your <em>functions.php</em> file. Don't forget to set the desired category ID on line 3.</p>
<pre>
function nofollow_cat_posts($text) {
global $post;
        if( in_category(1) ) { // SET CATEGORY ID HERE
                $text = stripslashes(wp_rel_nofollow($text));
        }
        return $text;
}
add_filter('the_content', 'nofollow_cat_posts');
</pre>
<p><strong><em>Thanks to <a href="http://www.sagive.co.il">Sagive</a> for submitting this function!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/li9E5gSdHXY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-add-nofollow-attributes-to-all-links-in-a-specific-category/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-add-nofollow-attributes-to-all-links-in-a-specific-category</feedburner:origLink></item>
		<item>
		<title>Automatically spam comments with a very long url</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/av8OJnunrnI/automatically-spam-comments-with-a-very-long-url</link>
		<comments>http://www.wprecipes.com/automatically-spam-comments-with-a-very-long-url#comments</comments>
		<pubDate>Tue, 14 May 2013 16:21:54 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3554</guid>
		<description><![CDATA[Spam is definitely a problem for bloggers and most of you probably receive more than 100 spam comments per hour. Here is a simple recipe to automatically mark as spam all comments with an url longer than 50 characters. ]]></description>
				<content:encoded><![CDATA[<p>Open your functions.php file and paste the code below in it. This code will automatically mark as spam all comments with an url longer than 50 chars. This can be changed on line 4.</p>
<pre>
&lt;?php

  function rkv_url_spamcheck( $approved , $commentdata ) {
    return ( strlen( $commentdata[&#39;comment_author_url&#39;] ) &gt; 50 ) ? &#39;spam&#39; : $approved;
  }

  add_filter( &#39;pre_comment_approved&#39;, &#39;rkv_url_spamcheck&#39;, 99, 2 );

?&gt;
</pre>
<p><strong><em>Thanks to <a href="http://css-tricks.com/snippets/wordpress/spam-comments-with-very-long-urls/?utm_source=dlvr.it&#038;utm_medium=twitter">CSS Tricks</a> for the code snippet!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/av8OJnunrnI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/automatically-spam-comments-with-a-very-long-url/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/automatically-spam-comments-with-a-very-long-url</feedburner:origLink></item>
		<item>
		<title>Deal of the week: SpyBar (3 licences to win!!)</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/gRydv2JERIc/deal-of-the-week-spybar-3-licences-to-win</link>
		<comments>http://www.wprecipes.com/deal-of-the-week-spybar-3-licences-to-win#comments</comments>
		<pubDate>Fri, 03 May 2013 13:01:51 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[contest]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3559</guid>
		<description><![CDATA[Today, I'm glad to introduce a new giveaway on WPRecipes, sponsored by our partners <a href="http://www.mightydeals.com/deal/spybar.html?ref=wprecipesspybar">Mighty Deals</a>. At the same time, I'm going to introduce SpyBar, an amazing tool for bloggers and website owners. ]]></description>
				<content:encoded><![CDATA[<h2>A word about Spybar</h2>
<p>The Internet is one huge swap meet. So many sites "borrow" code or plugins from other sites to make their own that much better. And then someone else borrows from their site, and so on. Keeping up with the latest and greatest Web features is an exhausting experience, though. You can check out tons of forums, blogs, newsletters and more just to read up on the latest releases. You can also pay a ton of money to various online services to pull in stats and suggestions.</p>
<p>The best way, though? Just browse. Check out what your competition's doing. If you find something you like, copy it. If only it were that easy to look beneath the hood. Well, it is. Thanks to <a href="http://www.mightydeals.com/deal/spybar.html?ref=wprecipesspybar">SpyBar</a>, you can pull in tons of useful data about any site, and you can do it all right from your Firefox or Chrome browser!</p>
<p>SpyBar is sold for only $7 for a limited time by <a href="http://www.mightydeals.com/deal/spybar.html?ref=wprecipesspybar">Mighty Deals</a>.</p>
<p>Here is a video demo of Spybar in action:<br />
<iframe frameborder="0" src="http://www.youtube.com/embed/i4KdQGFcyFo?vq=hd720&amp;rel=0" height="366" width="620"></iframe></p>
<h2>How to win a free Spybar licence!</h2>
<p>Our partners from <a href="http://www.mightydeals.com/deal/spybar.html?ref=wprecipesspybar">Mighty Deals</a> are happy to give away 3 Spybar licences to WPRecipes readers. To enter the contest, simply leave a comment to this post to let me know you'd like to win a free Spybar licence. I'll randomly pick 3 lucky winners on sunday using random.org. Winners will receive their prize directly in their email.</p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/gRydv2JERIc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/deal-of-the-week-spybar-3-licences-to-win/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/deal-of-the-week-spybar-3-licences-to-win</feedburner:origLink></item>
		<item>
		<title>How to make translatable JavaScript strings on your WordPress theme</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/2o_DMkgmt2Y/how-to-make-translatable-javascript-strings-on-your-wordpress-theme</link>
		<comments>http://www.wprecipes.com/how-to-make-translatable-javascript-strings-on-your-wordpress-theme#comments</comments>
		<pubDate>Mon, 29 Apr 2013 20:17:46 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3485</guid>
		<description><![CDATA[Do you know that WordPress have a function called wp_localize_script(), which allow you to localize JavaScript strings? Here's a practical example on how to use this little known but very useful function. ]]></description>
				<content:encoded><![CDATA[<p>Simply paste the following code into your function.php file, where you generally enqueue scripts and styles. Line 4 shows how to use the <em>wp_localize_script()</em> function.</p>
<pre>
function prefix_enqueue_custom_script(){
	wp_register_script( &#39;prefix_custom_script&#39;, plugin_dir_url( __FILE__ ) .&#39;js/custom-script.js&#39;, array( &#39;jquery&#39; ) );
        wp_enqueue_script( &#39;prefix_custom_script&#39; );
        wp_localize_script( &#39;prefix_custom_script&#39;, &#39;prefix_object_name&#39;, array(
		&#39;upload&#39; =&gt; __( &#39;upload&#39;, &#39;textdomain&#39; ),
		&#39;remove&#39; =&gt; __( &#39;remove&#39;, &#39;textdomain&#39; )
	) );
}
</pre>
<p><strong><em>Thanks to <a href="http://wptheming.com/2013/01/translatable-javascript-strings-in-wordpress/">Devin</a> for this code!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/2o_DMkgmt2Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-make-translatable-javascript-strings-on-your-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-make-translatable-javascript-strings-on-your-wordpress-theme</feedburner:origLink></item>
		<item>
		<title>How to add SVG upload support to your WordPress blog</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/A1Z_CemYntA/how-to-add-svg-upload-support-to-your-wordpress-blog</link>
		<comments>http://www.wprecipes.com/how-to-add-svg-upload-support-to-your-wordpress-blog#comments</comments>
		<pubDate>Thu, 25 Apr 2013 14:21:43 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3545</guid>
		<description><![CDATA[By default, WordPress uploader do not support the SVG format. As this file format is becoming quite popular theses days, here is a simple recipe to add SVG upload to your WordPress install. ]]></description>
				<content:encoded><![CDATA[<p>Simply add the code below to <em>functions.php</em> in your WordPress theme. SVG upload will be supported once the file is saved.</p>
<pre>
add_filter(&#39;upload_mimes&#39;, &#39;my_upload_mimes&#39;);
 
function my_upload_mimes($mimes = array()) {
    $mimes[&#39;svg&#39;] = &#39;image/svg+xml&#39;;
    return $mimes;
}
</pre>
<p><strong><em>Thanks to <a href="https://gist.github.com/dbushell/4247060">dbushell</a> for the snippet!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/A1Z_CemYntA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-add-svg-upload-support-to-your-wordpress-blog/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-add-svg-upload-support-to-your-wordpress-blog</feedburner:origLink></item>
		<item>
		<title>How to create a directory within the uploads folder</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/dxRW3aFgg50/how-to-create-a-directory-within-the-uploads-folder</link>
		<comments>http://www.wprecipes.com/how-to-create-a-directory-within-the-uploads-folder#comments</comments>
		<pubDate>Tue, 23 Apr 2013 16:23:24 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[content]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3542</guid>
		<description><![CDATA[When developing a plugin or theme, it can be useful to be able to programmatically create a directory within the wp-content/uploads folder. Here is a handy piece of code to do it.]]></description>
				<content:encoded><![CDATA[<p>Simply paste this code snippet on your <em>functions.php</em> file (or plugin file if you're creating a plugin) </p>
<pre>
function myplugin_activate() {
    
    $upload = wp_upload_dir();
    $upload_dir = $upload[&#39;basedir&#39;];
    $upload_dir = $upload_dir . &#39;/mypluginfiles&#39;;
    if (! is_dir($upload_dir)) {
       mkdir( $upload_dir, 0700 );
    }
}
 
register_activation_hook( __FILE__, &#39;myplugin_activate&#39; );
</pre>
<p><strong><em>Thanks to <a href="http://www.wpmayor.com/code/code-snippet-to-create-a-directory-within-uploads-folder/">Jean Galea</a> for the snippet!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/dxRW3aFgg50" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-create-a-directory-within-the-uploads-folder/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-create-a-directory-within-the-uploads-folder</feedburner:origLink></item>
		<item>
		<title>How to display an author bio excerpt on your WordPress blog</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/UtPZ-ZOOU4E/how-to-display-an-author-bio-excerpt-on-your-wordpress-blog</link>
		<comments>http://www.wprecipes.com/how-to-display-an-author-bio-excerpt-on-your-wordpress-blog#comments</comments>
		<pubDate>Tue, 16 Apr 2013 13:52:35 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[author]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3538</guid>
		<description><![CDATA[WordPress offers users the option to add biographical info for each author. This bio can be displayed on your theme using the the_author_meta( 'description' ) function. But what if you'd like to display only a bio excerpt? Here's a function to do it.]]></description>
				<content:encoded><![CDATA[<p>The first thing to do is to create the function. To do so, paste the following code into your <em>functions.php</em> file:
<pre>
&lt;?php
	function author_excerpt (){	                     					
		$word_limit = 20; // Limit the number of words
		$more_txt = &#39;read more about:&#39;; // The read more text
		$txt_end = &#39;...&#39;; // Display text end 
		$authorName = get_the_author();
		$authorUrl = get_author_posts_url( get_the_author_meta(&#39;ID&#39;));
		$authorDescription = explode(&quot; &quot;, get_the_author_meta(&#39;description&#39;));
		$displayAuthorPageLink = count($authorDescription) &gt; $word_limit ? $txt_end.&#39;&lt;br /&gt; &#39;.$more_txt.&#39; &lt;a href=&quot;&#39;.$authorUrl.&#39;&quot;&gt;&#39;.$authorName.&#39;&lt;/a&gt;&#39; : &#39;&#39; ;
		$authorDescriptionShort = array_slice($authorDescription, 0, ($word_limit));
		return (implode($authorDescriptionShort, &#39; &#39;)).$displayAuthorPageLink; 		
	}
?&gt;
</pre>
<p>Once done, simply call the function when needed, as shown below:</p>
<pre>
&lt;?php  if (function_exists(&#39;author_excerpt&#39;)){echo author_excerpt();} ?&gt;
</pre>
<p><strong><em>Thanks to <a href="http://www.seoreviewtools.com/author-description-excerpt-wordpress/">Tim Marcher</a> for the tip!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/UtPZ-ZOOU4E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-display-an-author-bio-excerpt-on-your-wordpress-blog/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-display-an-author-bio-excerpt-on-your-wordpress-blog</feedburner:origLink></item>
		<item>
		<title>How to detect a comments page on your WordPress blog</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/f3IW_AiKMJI/how-to-detect-a-comments-page-on-your-wordpress-blog</link>
		<comments>http://www.wprecipes.com/how-to-detect-a-comments-page-on-your-wordpress-blog#comments</comments>
		<pubDate>Mon, 15 Apr 2013 14:04:02 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[comments]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3529</guid>
		<description><![CDATA[On WordPress dashboard, there's an option to divide comments lists in sub pages. Unfortunately, there's no built-in conditional tag to know if you're currently on a comment page. So let's built one!]]></description>
				<content:encoded><![CDATA[<p>Simply put the following code anywhere on your theme files. If you're on a comment page, the conditional statement will return true, so any code within brackets will be executed. </p>
<pre>
$cpage = get_query_var( &#39;cpage&#39; );
if ( is_singular() &amp;&amp; $cpage &gt; 0 ){
    // Your code here
}
</pre>
<p>This code works on posts, pages, attachments as well as all custom post_types.</p>
<p><strong><em>Thanks to <a href="http://www.seomix.fr/page-commentaire-wordpress/">Daniel Roch</a> for the cool tip!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/f3IW_AiKMJI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-detect-a-comments-page-on-your-wordpress-blog/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-detect-a-comments-page-on-your-wordpress-blog</feedburner:origLink></item>
		<item>
		<title>How to force your WordPress blog to break out of frames</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/BAgNwuWSTCY/how-to-force-your-wordpress-blog-to-break-out-of-frames</link>
		<comments>http://www.wprecipes.com/how-to-force-your-wordpress-blog-to-break-out-of-frames#comments</comments>
		<pubDate>Thu, 11 Apr 2013 14:54:00 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3519</guid>
		<description><![CDATA[Lots of scrapers are framing, defaming, and/or stealing your precious content. Here is a super useful snippet to force your blog to break out of frames so your pages will be served only from the original domain, not some Google adsense site created by a random scraper.]]></description>
				<content:encoded><![CDATA[<p>Nothing complicated, just paste the code below into your <em>functions.php</em> file, save it, and you're done.</p>
<pre>
// Break Out of Frames for WordPress
function break_out_of_frames() {
	if (!is_preview()) {
		echo &quot;\n&lt;script type=\&quot;text/javascript\&quot;&gt;&quot;;
		echo &quot;\n&lt;!--&quot;;
		echo &quot;\nif (parent.frames.length &gt; 0) { parent.location.href = location.href; }&quot;;
		echo &quot;\n--&gt;&quot;;
		echo &quot;\n&lt;/script&gt;\n\n&quot;;
	}
}
add_action(&#39;wp_head&#39;, &#39;break_out_of_frames&#39;);
</pre>
<p><strong><em>Thanks to <a href="http://wp-mix.com/break-out-of-frames-wordpress/">WP Mix</a> for this very handy tip!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/BAgNwuWSTCY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-force-your-wordpress-blog-to-break-out-of-frames/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-force-your-wordpress-blog-to-break-out-of-frames</feedburner:origLink></item>
		<item>
		<title>How to redirect to post if search results only returns one post</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/W-LBqqlLPko/how-to-redirect-to-post-if-search-results-only-returns-one-post</link>
		<comments>http://www.wprecipes.com/how-to-redirect-to-post-if-search-results-only-returns-one-post#comments</comments>
		<pubDate>Thu, 04 Apr 2013 14:41:54 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=3515</guid>
		<description><![CDATA[When a reader search your site using WordPress built-in search engine, the results are displayed as a list. Here is a snippet to improve the search engine by automatically redirecting the reader to the post if only one post is found by WordPress search engine.]]></description>
				<content:encoded><![CDATA[<p>Just paste the following code snippet into your <em>functions.php</em> file:</p>
<pre>
add_action(&#39;template_redirect&#39;, &#39;redirect_single_post&#39;);
function redirect_single_post() {
    if (is_search()) {
        global $wp_query;
        if ($wp_query-&gt;post_count == 1) {
            wp_redirect( get_permalink( $wp_query-&gt;posts[&#39;0&#39;]-&gt;ID ) );
        }
    }
}
</pre>
<p><strong><em>Thanks to <a href="http://www.paulund.co.uk/redirect-search-results-return-one-post">Paulund.co.uk</a> for the snippet!</em></strong></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/W-LBqqlLPko" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-redirect-to-post-if-search-results-only-returns-one-post/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-redirect-to-post-if-search-results-only-returns-one-post</feedburner:origLink></item>
	</channel>
</rss>
