<?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>Mon, 06 Sep 2010 06:34:14 +0000</lastBuildDate>
	<language>en</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>WordPress hack: Automatically add post name to the body class</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/44Lo_kwIP-Q/wordpress-hack-automatically-add-post-name-to-the-body-class</link>
		<comments>http://www.wprecipes.com/wordpress-hack-automatically-add-post-name-to-the-body-class#comments</comments>
		<pubDate>Mon, 06 Sep 2010 06:34:14 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2639</guid>
		<description><![CDATA[Introduced in WordPress 2.8, body_class() is a very useful function when it comes to styling themes. In this recipe, I'll show you how you can add post name to the function for an even easier styling.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-hack-automatically-add-post-name-to-the-body-class">WordPress hack: Automatically add post name to the body class</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The only thing you have to do is to copy the following function and paste it on your theme <em>functions.php</em> file. Once saved, the post/page name will be automatically be added to the body class.</p>
<pre>
function wpprogrammer_post_name_in_body_class( $classes ){
	if( is_singular() )
	{
		global $post;
		array_push( $classes, &quot;{$post-&gt;post_type}-{$post-&gt;post_name}&quot; );
	}
	return $classes;
}

add_filter( &#39;body_class&#39;, &#39;wpprogrammer_post_name_in_body_class&#39; );
</pre>
<p><strong><em>Thanks to <a href="http://wpprogrammer.com/snippets/add-post-page-name-to-body-class/">Utkarsh Kukreti</a> for this great hack!</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-hack-automatically-add-post-name-to-the-body-class">WordPress hack: Automatically add post name to the body class</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/44Lo_kwIP-Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/wordpress-hack-automatically-add-post-name-to-the-body-class/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/wordpress-hack-automatically-add-post-name-to-the-body-class</feedburner:origLink></item>
		<item>
		<title>WordPress hack: Get rid of HTML in comments</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/qzGTdp3yens/wordpress-hack-get-rid-of-html-in-comments</link>
		<comments>http://www.wprecipes.com/wordpress-hack-get-rid-of-html-in-comments#comments</comments>
		<pubDate>Tue, 31 Aug 2010 11:43:23 +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=2643</guid>
		<description><![CDATA[HTML in comments can be a good things, but many times people abuse it, for example by inserting links. In this recipe, I'll show you how you can automatically get rid of any HTML entered in your post comments.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-hack-get-rid-of-html-in-comments">WordPress hack: Get rid of HTML in comments</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Just paste the code below into your functions.php file. If you prefer to use a plugin with the same functionality, you can grab one <a href="http://www.theblog.ca/literal-comments">here</a>.</p>
<pre>
// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {

	// convert everything in a comment to display literally
	$incoming_comment[&#39;comment_content&#39;] = htmlspecialchars($incoming_comment[&#39;comment_content&#39;]);

	// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
	$incoming_comment[&#39;comment_content&#39;] = str_replace( &quot;&#39;&quot;, &#39;&amp;apos;&#39;, $incoming_comment[&#39;comment_content&#39;] );

	return( $incoming_comment );
}

// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {

	// Put the single quotes back in
	$comment_to_display = str_replace( &#39;&amp;apos;&#39;, &quot;&#39;&quot;, $comment_to_display );

	return $comment_to_display;
}

add_filter( &#39;preprocess_comment&#39;, &#39;plc_comment_post&#39;, &#39;&#39;, 1);
add_filter( &#39;comment_text&#39;, &#39;plc_comment_display&#39;, &#39;&#39;, 1);
add_filter( &#39;comment_text_rss&#39;, &#39;plc_comment_display&#39;, &#39;&#39;, 1);
add_filter( &#39;comment_excerpt&#39;, &#39;plc_comment_display&#39;, &#39;&#39;, 1);
</pre>
<p><strong><em>Thanks to <a href="http://www.theblog.ca/literal-comments">Peter's useful crap</a> for this nice code!</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-hack-get-rid-of-html-in-comments">WordPress hack: Get rid of HTML in comments</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/qzGTdp3yens" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/wordpress-hack-get-rid-of-html-in-comments/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/wordpress-hack-get-rid-of-html-in-comments</feedburner:origLink></item>
		<item>
		<title>How to easily enable/disable debug mode in WordPress</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/qRwTD53_h6U/how-to-easily-enabledisable-debug-mode-in-wordpress</link>
		<comments>http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress#comments</comments>
		<pubDate>Fri, 27 Aug 2010 11:06:08 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2646</guid>
		<description><![CDATA[WordPress have a debug mode which allow you to easily get information when something goes wrong. To enable the debug mode, you have to add a constant to the wp-config.php file. But what about an easy way to switch on the debug mode, even without accessing wp-config.php?<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress">How to easily enable/disable debug mode in WordPress</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The first thing to do is to add the following code to your <em>wp-config.php</em> file. This file is located at the root of your WordPress install.</p>
<pre>
if ( isset($_GET['debug']) &#038;& $_GET['debug'] == 'debug')
  define('WP_DEBUG', true);
</pre>
<p>Once done, simply add a GET parameter to the url of the page you'd like to debug, as shown below:</p>
<pre>http://www.wprecipes.com/contact?debug=debug</pre>
<p><strong><em>Thanks to <a href="http://yoast.com/wordpress-debug/">Joost de Valk</a> for this great tip!</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress">How to easily enable/disable debug mode in WordPress</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/qRwTD53_h6U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress</feedburner:origLink></item>
		<item>
		<title>Add a Facebook “Like” button to your WordPress blog</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/pE26O3JRceg/add-a-facebook-like-button-to-your-wordpress-blog</link>
		<comments>http://www.wprecipes.com/add-a-facebook-like-button-to-your-wordpress-blog#comments</comments>
		<pubDate>Sat, 14 Aug 2010 18:17:04 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2634</guid>
		<description><![CDATA[Facebook is one of the largest and more popular websites of the world. Althought I do not have an account there, I figured out many of you would be interested in knowing how you can ad a "Like" button to your blog. That's very easy, just read this recipe.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/add-a-facebook-like-button-to-your-wordpress-blog">Add a Facebook &#8220;Like&#8221; button to your WordPress blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Open your single.php (or any file where you'd like the "Like" button to be displayed), and paste the following code:</p>
<pre>
&lt;iframe src=&quot;http://www.facebook.com/plugins/like.php?href=&lt;?php echo urlencode(get_permalink($post-&gt;ID)); ?&gt;&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; allowTransparency=&quot;true&quot; style=&quot;border:none; overflow:hidden; width:450px; height:25px&quot;&gt;&lt;/iframe&gt;
</pre>
<p>That's all. Once the file saved, the facebook "Like" button will be displayed. A live demo can be seen on <a href="http://www.visiter-newyork.com/">Visiter New York</a>.</p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/add-a-facebook-like-button-to-your-wordpress-blog">Add a Facebook &#8220;Like&#8221; button to your WordPress blog</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/pE26O3JRceg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/add-a-facebook-like-button-to-your-wordpress-blog/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/add-a-facebook-like-button-to-your-wordpress-blog</feedburner:origLink></item>
		<item>
		<title>WordPress tip: Close trackbacks on all posts at once</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/tSbo7ytWkDc/wordpress-tip-close-trackbacks-on-all-posts-at-once</link>
		<comments>http://www.wprecipes.com/wordpress-tip-close-trackbacks-on-all-posts-at-once#comments</comments>
		<pubDate>Wed, 11 Aug 2010 10:43:51 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2629</guid>
		<description><![CDATA[Do you use trackbacks and pings? Many people find them useless and asked me how they can get rid of them. Sure you can close trackbacks post by post, but this will consume a lot of time. Or you can use a good old SQl query, as shown in this article.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-tip-close-trackbacks-on-all-posts-at-once">WordPress tip: Close trackbacks on all posts at once</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Simply run the following SQL query on your WordPress database, using the command line client or PhpMyAdmin. This will close pingbacks/trackbacks on all existing posts.<br />
<strong>Don't forget to backup your database before using this query.</strong></p>
<pre>
UPDATE wp_posts SET ping_status = 'closed';
</pre>
<p>If you like to know more about WordPress SQL queries, you should have a look to <a href="http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries">this article</a>.</p>
<p><strong><em>Thanks to <a href="http://digwp.com/2010/08/wordpress-sql-comments">Jeff Starr</a> for this nice piece of code!</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-tip-close-trackbacks-on-all-posts-at-once">WordPress tip: Close trackbacks on all posts at once</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/tSbo7ytWkDc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/wordpress-tip-close-trackbacks-on-all-posts-at-once/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/wordpress-tip-close-trackbacks-on-all-posts-at-once</feedburner:origLink></item>
		<item>
		<title>WordPress function: Get category ID using category name</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/VIdiruShc68/wordpress-function-get-category-id-using-category-name</link>
		<comments>http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name#comments</comments>
		<pubDate>Thu, 29 Jul 2010 15:46:09 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[category id]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2622</guid>
		<description><![CDATA[When coding a WordPress site, you often need to get a category ID. If you ever wanted to be able to get a category ID from the category name, then just read this recipe, I'm pretty sure you will like it.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name">WordPress function: Get category ID using category name</a></p>
]]></description>
			<content:encoded><![CDATA[<p>As usual, let's start by pasting the function in your <em>functions.php</em> file:</p>
<pre>
function get_category_id($cat_name){
	$term = get_term_by('name', $cat_name, 'category');
	return $term->term_id;
}
</pre>
<p>Once you saved the file, just call the function with your category name as a parameter. Example:</p>
<pre>
$category_ID = get_category_id('WordPress Tutorials');
</pre>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name">WordPress function: Get category ID using category name</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/VIdiruShc68" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name</feedburner:origLink></item>
		<item>
		<title>How to display your average feed readers</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/MwdxAzidUCo/how-to-display-your-average-feed-readers</link>
		<comments>http://www.wprecipes.com/how-to-display-your-average-feed-readers#comments</comments>
		<pubDate>Fri, 23 Jul 2010 09:23:12 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2615</guid>
		<description><![CDATA[Many bloggers are using Feedburner "chicklet" to display their subscribers count. If you want to be able to display the count for an average 7 days, here is a piece of code you're going to love.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-display-your-average-feed-readers">How to display your average feed readers</a></p>
]]></description>
			<content:encoded><![CDATA[<p>As usual, the first thing to do is to paste the function in your <em>functions.php</em> file:</p>
<pre>
function get_average_readers($feed_id,$interval = 7){
	$today = date(&#39;Y-m-d&#39;, strtotime(&quot;now&quot;));
	$ago = date(&#39;Y-m-d&#39;, strtotime(&quot;-&quot;.$interval.&quot; days&quot;));
	$feed_url=&quot;https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=&quot;.$feed_id.&quot;&amp;dates=&quot;.$ago.&quot;,&quot;.$today;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $feed_url);
	$data = curl_exec($ch);
	curl_close($ch);
	$xml = new SimpleXMLElement($data);
	$fb = $xml-&gt;feed-&gt;entry[&#39;circulation&#39;];

	$nb = 0;
	foreach($xml-&gt;feed-&gt;children() as $circ){
		$nb += $circ[&#39;circulation&#39;];
	}

	return round($nb/$interval);
}
</pre>
<p>Once done, you can call the function wherever you want in your theme files. Pass your Feedburner feed id as a parameter: </p>
<pre>
&lt;?php
$nb = get_average_readers(&#39;catswhocode&#39;);
echo &quot;I have &quot;.$nb.&quot; RSS readers&quot;;
?&gt;
</pre>
<p><strong><em>Code initially published on <a href="http://www.catswhoblog.com/how-to-get-a-more-relevant-feedburner-count">Cats Who Blog</a>.</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-display-your-average-feed-readers">How to display your average feed readers</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/MwdxAzidUCo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-display-your-average-feed-readers/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-display-your-average-feed-readers</feedburner:origLink></item>
		<item>
		<title>Add categories or tags to post programatically</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/ZHm2kwVMAME/add-categories-or-tags-to-post-programatically</link>
		<comments>http://www.wprecipes.com/add-categories-or-tags-to-post-programatically#comments</comments>
		<pubDate>Mon, 19 Jul 2010 06:57:01 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2609</guid>
		<description><![CDATA[I recently shown you jow you can create a post or a comment programatically, which is very usefull when creating advanced WOrdPress themes or plugins. Today, let's have a look at another killer snippet: Add categories or tags to a posts, programatically.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/add-categories-or-tags-to-post-programatically">Add categories or tags to post programatically</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The first thing to do is to create an array of categories id. Once done, you simply have to use the <em>wp_set_object()</em> function, which take 3 parameters: The post id, an array of categories to add to the post, and the taxonomy type (category in this example).</p>
<pre>
$category_ids = array(4, 5, 6);
wp_set_object_terms( $post_id, $category_ids, 'category');
</pre>
<p>Adding tags to a post is extremely easy as well. The only difference with the code to add categories is the taxonomy "post_tag" instead of "category".</p>
<pre>
$tag_ids = array(7, 8, 9);
wp_set_object_terms( $post_id, $tag_ids, 'post_tag');
</pre>
<p><strong><em>Thanks to <a href="http://wpprogrammer.com/snippets/add-a-category-or-tag-to-a-post-programatically/">WPProgrammer</a> for this very cool snippet.</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/add-categories-or-tags-to-post-programatically">Add categories or tags to post programatically</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/ZHm2kwVMAME" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/add-categories-or-tags-to-post-programatically/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/add-categories-or-tags-to-post-programatically</feedburner:origLink></item>
		<item>
		<title>Display dates as “time ago”, the easy way</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/VslIY6nQhTM/display-dates-as-time-ago-the-easy-way</link>
		<comments>http://www.wprecipes.com/display-dates-as-time-ago-the-easy-way#comments</comments>
		<pubDate>Mon, 05 Jul 2010 04:26:41 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[date]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2600</guid>
		<description><![CDATA[Want to display human readable dates on your blog, such as "Posted 6 days ago?" There's a lot of available functions to do so, but only a few people know that WordPress have its own built-in function to do that. <p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/display-dates-as-time-ago-the-easy-way">Display dates as &#8220;time ago&#8221;, the easy way</a></p>
]]></description>
			<content:encoded><![CDATA[<p>To display human readable dates on your blog, you have to use the human_time_diff() function. The following piece of code will show a post date like "Posted 6 days ago".<br />
Paste it anywhere within the loop, save the file, and you're done.</p>
<pre>
Posted &lt;?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?&gt;
</pre>
<p><strong><em>Credits: <a href="http://www.phpsnippets.info/display-dates-as-time-ago">PHP Snippets</a>.</em></strong></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/display-dates-as-time-ago-the-easy-way">Display dates as &#8220;time ago&#8221;, the easy way</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/VslIY6nQhTM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/display-dates-as-time-ago-the-easy-way/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/display-dates-as-time-ago-the-easy-way</feedburner:origLink></item>
		<item>
		<title>How to programatically remove WordPress dashboard widgets</title>
		<link>http://feedproxy.google.com/~r/Wprecipes/~3/3DuXcyERdbg/how-to-programatically-remove-wordpress-dashboard-widgets</link>
		<comments>http://www.wprecipes.com/how-to-programatically-remove-wordpress-dashboard-widgets#comments</comments>
		<pubDate>Wed, 23 Jun 2010 10:35:30 +0000</pubDate>
		<dc:creator>Jean-Baptiste Jung</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.wprecipes.com/?p=2585</guid>
		<description><![CDATA[Added in version 2.7, the Dashboard Widget API allow you to ad widgets to your WordPress admin dashboard. In this recipe, I'll show you how you can easily remove them programatically.<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-programatically-remove-wordpress-dashboard-widgets">How to programatically remove WordPress dashboard widgets</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Simply paste the following into your functions.php file. The code will remove all dashboard widgets, so you should comment lines related to wigets you'd like to keep.</p>
<pre>
function remove_dashboard_widgets() {
	global $wp_meta_boxes;

	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;side&#39;][&#39;core&#39;][&#39;dashboard_quick_press&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;normal&#39;][&#39;core&#39;][&#39;dashboard_incoming_links&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;normal&#39;][&#39;core&#39;][&#39;dashboard_right_now&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;normal&#39;][&#39;core&#39;][&#39;dashboard_plugins&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;normal&#39;][&#39;core&#39;][&#39;dashboard_recent_drafts&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;normal&#39;][&#39;core&#39;][&#39;dashboard_recent_comments&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;side&#39;][&#39;core&#39;][&#39;dashboard_primary&#39;]);
	unset($wp_meta_boxes[&#39;dashboard&#39;][&#39;side&#39;][&#39;core&#39;][&#39;dashboard_secondary&#39;]);

}

if (!current_user_can(&#39;manage_options&#39;)) {
	add_action(&#39;wp_dashboard_setup&#39;, &#39;remove_dashboard_widgets&#39; );
}
</pre>
<p><strong><em>Thanks to <a href="http://noscope.com/journal/2010/03/wordpress-trick-remove-dashboard-widgets">NoScope</a> for this code!</em></strong></p>
<p><em>By the way, did you had a look to my latest post on <a href="http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0">CatsWhoCode</a> about WP 3.0 custom post types?</em></p>
<p><em>Looking for WordPress hosting? Try <a href="http://www.catswhocode.com/blog/wpwebhost.html">WP Web Host</a>. Prices starts at $5/month and you can try it for free!<br/><br/><a href="http://www.wprecipes.com/how-to-programatically-remove-wordpress-dashboard-widgets">How to programatically remove WordPress dashboard widgets</a></p>
<img src="http://feeds.feedburner.com/~r/Wprecipes/~4/3DuXcyERdbg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wprecipes.com/how-to-programatically-remove-wordpress-dashboard-widgets/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		<feedburner:origLink>http://www.wprecipes.com/how-to-programatically-remove-wordpress-dashboard-widgets</feedburner:origLink></item>
	</channel>
</rss>
