<?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>WpFunc &#187; Loop</title>
	<atom:link href="http://wpfunc.com/tag/loop/feed" rel="self" type="application/rss+xml" />
	<link>http://wpfunc.com</link>
	<description>Awesome, Quick, Simple WordPress Functions!</description>
	<lastBuildDate>Sun, 06 May 2012 02:21:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Add Numbers next to each post!</title>
		<link>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html</link>
		<comments>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html#comments</comments>
		<pubDate>Mon, 19 Apr 2010 21:23:21 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[article numbers]]></category>
		<category><![CDATA[article title]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[wordpress forums]]></category>
		<category><![CDATA[wprecipes]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=425</guid>
		<description><![CDATA[I found that trick in WordPress Forums. After i saw this trick into WpRecipes. You can add article numbers (ex. Article #1, Article #2) next to your posts. Let&#8217;s Begin&#8230; Here is the code; Add this code into your theme&#8217;s functions.php; After this you can use this short code when you call your article names. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I found that trick in <a href="http://wordpress.org/support/topic/375293?replies=5#post-1453605" target="_blank">WordPress Forums</a>. After i saw this trick into WpRecipes. You can add article numbers (ex. Article #1, Article #2) next to your posts. Let&#8217;s Begin&#8230;<span id="more-425"></span></p>
<h3 style="text-align: justify;">Here is the code;</h3>
<p style="text-align: justify;">Add this code into your <span style="color: #ff0000;"><strong>theme&#8217;s functions.php</strong></span>;</p>
<pre class="brush: php; title: ; notranslate">function updateNumbers() {
/* numbering the published posts: preparation: create an array with the ID in sequence of publication date, /
/ save the number in custom field 'incr_number' of post with ID  /
/ to show in post (within the loop) use &lt;?php echo get_post_meta($post-&gt;ID,'incr_number',true); ?&gt;
/ alchymyth 2010 */
global $wpdb;
$querystr = &quot;SELECT $wpdb-&gt;posts.* FROM $wpdb-&gt;posts WHERE $wpdb-&gt;posts.post_status = 'publish' AND $wpdb-&gt;posts.post_type = 'post' &quot;;
$pageposts = $wpdb-&gt;get_results($querystr, OBJECT);
$counts = 0 ;
if ($pageposts):
foreach ($pageposts as $post):
setup_postdata($post);
$counts++;
add_post_meta($post-&gt;ID, 'incr_number', $counts, true);
update_post_meta($post-&gt;ID, 'incr_number', $counts);
endforeach;
endif;
}

add_action ( 'publish_post', 'updateNumbers' );
add_action ( 'deleted_post', 'updateNumbers' );
add_action ( 'edit_post', 'updateNumbers' );</pre>
<p style="text-align: justify;">After this you can use this short code when you call your article names.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php echo get_post_meta($post-&gt;ID,'incr_number',true); ?&gt; </pre>
<p style="text-align: justify;">That&#8217;s All. Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a shortcode for displaying the Loop</title>
		<link>http://wpfunc.com/wordpress/create-a-shortcode-for-displaying-the-loop.html</link>
		<comments>http://wpfunc.com/wordpress/create-a-shortcode-for-displaying-the-loop.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 11:31:05 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[the_loop]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=277</guid>
		<description><![CDATA[Hi everybody. We can use WordPress as a CMS and we can change default loop area displaying for anywhere. We have to make a shortcode for this. Let&#8217;s Begin&#8230; Here is the code; Add this code to your theme&#8217;s functions.php and use shortcode in your teheme. ShortCode; That&#8217;s All. Have a nice day!]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Hi everybody. We can use WordPress as a CMS and we can change default loop area displaying for anywhere. We have to make a shortcode for this. Let&#8217;s Begin&#8230;<span id="more-277"></span></p>
<h3>Here is the code;</h3>
<p style="text-align: justify;">Add this code to your theme&#8217;s <span style="color: #ff0000;"><em><strong>functions.php</strong></em></span> and use <span style="color: #ff0000;"><em><strong>shortcode</strong></em></span> in your teheme.</p>
<pre class="brush: php; title: ; notranslate">function myLoop($atts, $content = null) {
	extract(shortcode_atts(array(
		&quot;pagination&quot; =&gt; 'true',
		&quot;query&quot; =&gt; '',
		&quot;category&quot; =&gt; '',
	), $atts));
	global $wp_query,$paged,$post;
	$temp = $wp_query;
	$wp_query= null;
	$wp_query = new WP_Query();
	if($pagination == 'true'){
		$query .= '&amp;paged='.$paged;
	}
	if(!empty($category)){
		$query .= '&amp;category_name='.$category;
	}
	if(!empty($query)){
		$query .= $query;
	}
	$wp_query-&gt;query($query);
	ob_start();
	?&gt;
	&lt;h2&gt;&lt;?php echo $category; ?&gt;&lt;/h2&gt;
	&lt;ul class=&quot;loop&quot;&gt;
	&lt;?php while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt;
		&lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php echo $thumbnail_image; the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;?php endwhile; ?&gt;
	&lt;/ul&gt;
	&lt;?php if(pagination == 'true'){ ?&gt;
	&lt;div class=&quot;navigation&quot;&gt;
	  &lt;div class=&quot;alignleft&quot;&gt;&lt;?php previous_posts_link('« Previous') ?&gt;&lt;/div&gt;
	  &lt;div class=&quot;alignright&quot;&gt;&lt;?php next_posts_link('More »') ?&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;?php } ?&gt;
	&lt;?php $wp_query = null; $wp_query = $temp;
	$content = ob_get_contents();
	ob_end_clean();
	return $content;
}
add_shortcode(&quot;loop&quot;, &quot;myLoop&quot;);
</pre>
<h3>ShortCode;</h3>
<pre class="brush: php; title: ; notranslate">[loop category=&quot;news&quot; query=&quot;&quot; pagination=&quot;false&quot;]</pre>
<p>That&#8217;s All. Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/create-a-shortcode-for-displaying-the-loop.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add an expration date for posts!</title>
		<link>http://wpfunc.com/wordpress/add-an-expration-date-for-posts.html</link>
		<comments>http://wpfunc.com/wordpress/add-an-expration-date-for-posts.html#comments</comments>
		<pubDate>Sun, 19 Jul 2009 07:00:25 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[expration]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=52</guid>
		<description><![CDATA[If you want to add an expration date to your posts you have to change your WordPress&#8217; Loop area. This is not delete your posts, only turns to draft. When you change Loop area you will able to add an expration date with custom fileds. This is very simple function/recipe.Firstly you have to change your [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">If you want to add an expration date to your posts you have to change your WordPress&#8217; Loop area. This is not delete your posts, only turns to draft. When you change Loop area you will able to add an expration date with custom fileds. This is very simple function/recipe.<span id="more-52"></span>Firstly you have to change your <strong><em>Loop</em></strong><span style="color: #ff0000;"> <span style="color: #000000;">area. You have to change your theme files for this.</span><em><strong> </strong></em></span><span style="color: #ff0000;"><em><strong>Every Loop area must change.</strong></em></span></p>
<p>Change your <em><strong>Loop</strong></em> area wtih this code.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
if (have_posts()) :
     while (have_posts()) : the_post(); ?&gt;
         $expirationtime = get_post_custom_values('expiration');
         if (is_array($expirationtime)) {
             $expirestring = implode($expirationtime);
         }

         $secondsbetween = strtotime($expirestring)-time();
         if ( $secondsbetween &gt; 0 ) {
             // For example...
             the_title();
             the_excerpt();
         }
     endwhile;
endif;
?&gt;
</pre>
<p style="text-align: justify;">After apply this code you can add a custom filed, the name of custom filed is <em><strong><span style="color: #ff0000;">expration</span></strong></em>. The custom fileds value must be like <strong><span style="color: #ff0000;">mm/dd/yyyy 00:00:00</span></strong>.</p>
<p style="text-align: justify;">That&#8217;s All! Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/add-an-expration-date-for-posts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

