<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>&#60;SourceBench/&#62; Your place to share code stuff &#187; WordPress</title>
	<atom:link href="http://sourcebench.com/category/languages/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://sourcebench.com</link>
	<description></description>
	<lastBuildDate>Tue, 04 May 2010 07:57:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Post Meta fields class set &#8211; easy custom fields for WordPress</title>
		<link>http://sourcebench.com/languages/wordpress/easy-post-meta-fields-class-set-easy-custom-fields-for-wordpress/</link>
		<comments>http://sourcebench.com/languages/wordpress/easy-post-meta-fields-class-set-easy-custom-fields-for-wordpress/#comments</comments>
		<pubDate>Tue, 04 May 2010 07:56:40 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[custom post fields]]></category>
		<category><![CDATA[easy custom fields]]></category>
		<category><![CDATA[post meta]]></category>
		<category><![CDATA[post meta fields]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/easy-post-meta-fields-class-set-easy-custom-fields-for-wordpress/</guid>
		<description><![CDATA[If you ever needed to work with post meta fields and did not want to mess around with validation and all this stuff around it check out http://wordpress.org/extend/plugins/easy-custom-fields/ for a simple set of classes to build on.]]></description>
			<content:encoded><![CDATA[<p>If you ever needed to work with post meta fields and did not want to mess around with validation and all this stuff around it check out <a href="http://wordpress.org/extend/plugins/easy-custom-fields/" rel="nofollow">http://wordpress.org/extend/plugins/easy-custom-fields/</a> for a simple set of classes to build on.</p>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/easy-post-meta-fields-class-set-easy-custom-fields-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically insert meta description tag into posts/pages.</title>
		<link>http://sourcebench.com/languages/wordpress/automatically-insert-meta-description-tag-into-postspages/</link>
		<comments>http://sourcebench.com/languages/wordpress/automatically-insert-meta-description-tag-into-postspages/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 09:49:04 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[meta description]]></category>
		<category><![CDATA[wp_head]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/automatically-insert-meta-description-tag-into-postspages/</guid>
		<description><![CDATA[&#60;?php
/**
 * Automatically insert meta description tag into posts/pages.
 * - can be configured to use either first X chars/words of the post content or post excerpt if available
 * - can use category description for category archive pages if available
 * - can use tag description for tag archive pages if available
 * - [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">&lt;?php
/**
 * Automatically insert meta description tag into posts/pages.
 * - can be configured to use either first X chars/words of the post content or post excerpt if available
 * - can use category description for category archive pages if available
 * - can use tag description for tag archive pages if available
 * - can use blog description for everything else
 * - can use a default description if no suitable value is found
 * - can use the value of a custom field as description
 *
 * @usage
 * // add a custom configuration via filter
 * function set_meta_desc_settings( $settings ) {
 * 		return array( 'length' =&gt; 10, 'length_unit' =&gt; 'char|word', 'use_excerpt' =&gt; true, 'add_category_desc' =&gt; true, 'add_tag_desc' =&gt; true, 'add_other_desc' =&gt; true, 'default_description' =&gt; '', 'custom_field_key' =&gt; '' );
 * }
 * add_filter( 'meta_desc_settings', 'set_meta_desc_settings' );
 * add_action( 'wp_head', 'meta_desc' );
 *
 * @author Thorsten Ott
 */
function meta_desc() {
	$default_settings = array(
								'length' =&gt; 25, // amount of length units to use for the meta description
								'length_unit' =&gt; 'word', // the length unit can be either &quot;word&quot; or &quot;char&quot;
								'use_excerpt' =&gt; true, // if the post/page has an excerpt it will overwrite the generated description if this is set to true
								'add_category_desc' =&gt; true, // add the category description to category views if this value is true
								'add_tag_desc' =&gt; true, // add the category description to category views if this value is true
								'add_other_desc' =&gt; true, // add the blog description/tagline to all other pages if this value is true
								'default_description' =&gt; '', // in case no description is defined use this as a default description
								'custom_field_key' =&gt; '', // if a custom field key is set we try to use the value of this field as description
								);

	$settings = apply_filters( 'meta_desc_settings', $default_settings );

	extract( shortcode_atts( $default_settings, $settings ) );

	global $wp_query;

	if( is_single() || is_page() ) {
		$post = $wp_query-&gt;post;

		// check for a custom field holding a description
		if ( !empty( $custom_field_key ) ) {
			$post_custom = get_post_custom_values( $custom_field_key, $post-&gt;ID );
			if ( !empty( $post_custom ) )
				$text = $post_custom[0];
		}
		// check for an excerpt we can use
		else if( $use_excerpt &amp;&amp; !empty( $post-&gt;post_excerpt ) ) {
			$text = $post-&gt;post_excerpt;
		}
		// otherwise use the content
		else {
			$text = $post-&gt;post_content;
		}

		$text = str_replace( array( &quot;\r\n&quot;, &quot;\r&quot;, &quot;\n&quot;, &quot;  &quot; ), &quot; &quot;, $text ); // get rid of all line breaks
		$text = strip_shortcodes( $text ); // make sure to get rid of shortcodes
		$text = apply_filters( 'the_content', $text ); // make sure it's save
		$text = trim( strip_tags( $text ) ); // get rid of tags and html fragments
		if ( empty( $text ) &amp;&amp; !empty( $default_description ) )
			$text = $default_description;	

	} else if( is_category() &amp;&amp; true == $add_category_desc ) {
		$category = $wp_query-&gt;get_queried_object();
		$text = trim( strip_tags( $category-&gt;category_description ) );
		if ( empty( $text ) &amp;&amp; !empty( $default_description ) )
			$text = $default_description;

	} else if( is_tag() &amp;&amp; true == $add_tag_desc ) {
		$tag = $wp_query-&gt;get_queried_object();
		$text = trim( strip_tags( $tag-&gt;description ) );
		if ( empty( $text ) &amp;&amp; !empty( $default_description ) )
			$text = $default_description;

	} else if ( true == $add_other_desc ) {
		$text = trim( strip_tags( get_bloginfo('description') ) );
		if ( empty( $text ) &amp;&amp; !empty( $default_description ) )
			$text = $default_description;
	}

	if ( empty( $text ) )
		return;

	if ( 'word' == $length_unit ) {
		$words = explode(' ', $text, $length + 1);
		if ( count( $words ) &gt; $length ) {
			array_pop( $words );
			array_push( $words, '...' );
			$text = implode( ' ', $words );
		}
	} else {
		if ( strlen( $text ) &gt; $length ) {
			$text = mb_strimwidth( $text, 0, $length, '...' );
		}
	}

	if ( !empty( $text ) ) {
		echo &quot;\n&lt;meta name=\&quot;description\&quot; content=\&quot;$text\&quot; /&gt;\n&quot;;
	}
}
?&gt;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/automatically-insert-meta-description-tag-into-postspages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Always expand threads in single views with p2theme</title>
		<link>http://sourcebench.com/languages/wordpress/always-expand-threads-in-single-views-with-p2theme/</link>
		<comments>http://sourcebench.com/languages/wordpress/always-expand-threads-in-single-views-with-p2theme/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 15:02:06 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[p2]]></category>
		<category><![CDATA[p2theme]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[toggle]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/always-expand-threads-in-single-views-with-p2theme/</guid>
		<description><![CDATA[// as on this page i wanted to have comment threads only collapsed
// on category/frontpage and search views but expanded on views with is_single()
// to do so open the file in/js.php in your p2 theme and search for p2_toggle_threads
// and replace $hide_threads = get_option( 'p2_hide_threads' ); ?&#62; with

	if ( !is_single() )
		$hide_threads = get_option( 'p2_hide_threads' );
	else
		$hide_threads [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">// as on this page i wanted to have comment threads only collapsed
// on category/frontpage and search views but expanded on views with is_single()
// to do so open the file in/js.php in your p2 theme and search for p2_toggle_threads
// and replace $hide_threads = get_option( 'p2_hide_threads' ); ?&gt; with

	if ( !is_single() )
		$hide_threads = get_option( 'p2_hide_threads' );
	else
		$hide_threads = 0; ?&gt;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/always-expand-threads-in-single-views-with-p2theme/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make links in P2 quotes clickable</title>
		<link>http://sourcebench.com/languages/wordpress/make-links-in-p2-quotes-clickable/</link>
		<comments>http://sourcebench.com/languages/wordpress/make-links-in-p2-quotes-clickable/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 14:55:51 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[clickable]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[p2]]></category>
		<category><![CDATA[p2theme]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/make-links-in-p2-quotes-clickable/</guid>
		<description><![CDATA[// by default links in p2 quotes are not clickable. to make them clickable simply add the following to your functions.php
add_filter( 'p2_get_quote_content', 'make_clickable' );]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">// by default links in p2 quotes are not clickable. to make them clickable simply add the following to your functions.php
add_filter( 'p2_get_quote_content', 'make_clickable' );</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/make-links-in-p2-quotes-clickable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Display posts by the TAG usage. Most used tags and their posts go first</title>
		<link>http://sourcebench.com/languages/wordpress/display-posts-by-the-tag-usage-most-used-tags-and-their-posts-go-first/</link>
		<comments>http://sourcebench.com/languages/wordpress/display-posts-by-the-tag-usage-most-used-tags-and-their-posts-go-first/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:13:34 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[tag usage]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[top posts]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/display-posts-by-the-tag-usage-most-used-tags-and-their-posts-go-first/</guid>
		<description><![CDATA[&#60;?php
/*
 * Display posts order by the frequency a tag is used.
 * Most used tags first with the posts in it.
 * Found at http://www.devlounge.net/code/wordpress-snippet-display-posts-by-tag-frequency
 */
  $noOfTags = 10;
  $noOfPosts = 4;
  $cloudRight = get_tags(&#34;orderby=count&#38;order=DESC&#38;number=$noOfTags&#34;);
  foreach((array)$cloudRight as $tagRight) : ?&#62;
	  &#60;?php
	  $postsRight = new WP_Query();
	  $postsRight-&#62;query(&#34;tag={$tagRight-&#62;slug}&#38;showposts=$noOfPosts&#34;);
	  [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">&lt;?php
/*
 * Display posts order by the frequency a tag is used.
 * Most used tags first with the posts in it.
 * Found at <a href="http://www.devlounge.net/code/wordpress-snippet-display-posts-by-tag-frequency" rel="nofollow">http://www.devlounge.net/code/wordpress-snippet-display-posts-by-tag-frequency</a>
 */
  $noOfTags = 10;
  $noOfPosts = 4;
  $cloudRight = get_tags(&quot;orderby=count&amp;order=DESC&amp;number=$noOfTags&quot;);
  foreach((array)$cloudRight as $tagRight) : ?&gt;
	  &lt;?php
	  $postsRight = new WP_Query();
	  $postsRight-&gt;query(&quot;tag={$tagRight-&gt;slug}&amp;showposts=$noOfPosts&quot;);
	  ?&gt;
	  &lt;?php if ( $postsRight-&gt;have_posts() ) <img src='http://sourcebench.com/wp-includes/images/smilies/icon_confused.gif' alt=':?' class='wp-smiley' /> &gt;
		&lt;dl class=&quot;xoxo&quot;&gt;
		  &lt;dt&gt;&lt;?php echo $tagRight-&gt;name ?&gt;&lt;/dt&gt;
		  &lt;?php while ( $postsRight-&gt;have_posts() ) : $postsRight-&gt;the_post(); ?&gt;
		  &lt;dd&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/dd&gt;
		  &lt;?php endwhile;?&gt;
		&lt;/dl&gt;
	  &lt;?php endif; ?&gt;
  &lt;?php
	unset($postsRight);
  endforeach;
?&gt;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/display-posts-by-the-tag-usage-most-used-tags-and-their-posts-go-first/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A really simple way to show top posts determined by comment count</title>
		<link>http://sourcebench.com/languages/wordpress/a-really-simple-way-to-show-top-posts-determined-by-comment-count/</link>
		<comments>http://sourcebench.com/languages/wordpress/a-really-simple-way-to-show-top-posts-determined-by-comment-count/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:05:52 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[top posts]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/wordpress/a-really-simple-way-to-show-top-posts-determined-by-comment-count/</guid>
		<description><![CDATA[&#60;?php
// a simple way to get most popular posts by comment count, just throw it in your templatefile and alter t your needs
$max = 10; // amount of posts to get
?&#62;
&#60;ul&#62;
&#60;?php
$result = $wpdb-&#62;get_results( $wpdb-&#62;prepare( &#34;SELECT comment_count,ID,post_title FROM $wpdb-&#62;posts ORDER BY comment_count DESC LIMIT 0, %d&#34;, $max ) );
foreach ($result as $post) :
	setup_postdata($post);
	$postid = $post-&#62;ID;
	$title = [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">&lt;?php
// a simple way to get most popular posts by comment count, just throw it in your templatefile and alter t your needs
$max = 10; // amount of posts to get
?&gt;
&lt;ul&gt;
&lt;?php
$result = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT comment_count,ID,post_title FROM $wpdb-&gt;posts ORDER BY comment_count DESC LIMIT 0, %d&quot;, $max ) );
foreach ($result as $post) :
	setup_postdata($post);
	$postid = $post-&gt;ID;
	$title = $post-&gt;post_title;
	$commentcount = $post-&gt;comment_count;
	if ($commentcount != 0) :
?&gt;
		&lt;li&gt;
			&lt;a href=&quot;&lt;?php echo get_permalink($postid); ?&gt;&quot; title=&quot;&lt;?php echo $title ?&gt;&quot;&gt; &lt;?php echo $title ?&gt;&lt;/a&gt; (&lt;?php echo $commentcount ?&gt;)
		&lt;/li&gt;
&lt;?php
	endif;
endforeach;
?&gt;
&lt;/ul&gt;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/wordpress/a-really-simple-way-to-show-top-posts-determined-by-comment-count/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
