<?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; the_loop</title>
	<atom:link href="http://www.wpfunc.com/tag/the_loop/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wpfunc.com</link>
	<description>Awesome, Quick, Simple WordPress Functions!</description>
	<lastBuildDate>Fri, 09 Jul 2010 09:05:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Create a shortcode for displaying the Loop</title>
		<link>http://www.wpfunc.com/wordpress/create-a-shortcode-for-displaying-the-loop.html</link>
		<comments>http://www.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>KaiseRCrazY</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.
function myLoop($atts, $content = null) {
	extract(shortcode_atts(array(
		&#34;pagination&#34; =&#62; 'true',
		&#34;query&#34; =&#62; '',
		&#34;category&#34; =&#62; '',
	), [...]<hr /><div style="text-align:center;">
<a href="http://aweber.com/?339698" title="Email Marketing">
<img src="http://www.aweber.com/banners/email_marketing/468x60_an.gif" alt="Email Marketing $19/Month!" style="border:none;" /></a>
</div><hr />


Related posts:<ol><li><a href='http://www.wpfunc.com/wordpress/create-pdf-button.html' rel='bookmark' title='Permanent Link: Create PDF Button'>Create PDF Button</a></li>
<li><a href='http://www.wpfunc.com/wordpress/add-numbers-next-to-each-post.html' rel='bookmark' title='Permanent Link: Add Numbers next to each post!'>Add Numbers next to each post!</a></li>
<li><a href='http://www.wpfunc.com/wordpress/create-custom-date-butons.html' rel='bookmark' title='Permanent Link: Create Custom Date Butons!'>Create Custom Date Butons!</a></li>
</ol>]]></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;">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;">[loop category=&quot;news&quot; query=&quot;&quot; pagination=&quot;false&quot;]</pre>
<p>That&#8217;s All. Have a nice day!</p>
<a rel='nofollow' target='_blank'  href='http://delicious.com/post?url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;title=Create%20a%20shortcode%20for%20displaying%20the%20Loop&amp;notes=Hi%20everybody.%20We%20can%20use%20WordPress%20as%20a%20CMS%20and%20we%20can%20change%20default%20loop%20area%20displaying%20for%20anywhere.%20We%20have%20to%20make%20a%20shortcode%20for%20this.%20Let%27s%20Begin...%0D%0A%0D%0AHere%20is%20the%20code%3B%0D%0AAdd%20this%20code%20to%20your%20theme%27s%20functions.php%20and%20use%20shortcode%20in%20your%20'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/delicious.png' class='sociable-img sociable-hovers ' title='del.icio.us' alt='del.icio.us' /></a><a rel='nofollow' target='_blank'  href='http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;title=Create%20a%20shortcode%20for%20displaying%20the%20Loop&amp;bodytext=Hi%20everybody.%20We%20can%20use%20WordPress%20as%20a%20CMS%20and%20we%20can%20change%20default%20loop%20area%20displaying%20for%20anywhere.%20We%20have%20to%20make%20a%20shortcode%20for%20this.%20Let%27s%20Begin...%0D%0A%0D%0AHere%20is%20the%20code%3B%0D%0AAdd%20this%20code%20to%20your%20theme%27s%20functions.php%20and%20use%20shortcode%20in%20your%20'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/digg.png' class='sociable-img sociable-hovers ' title='Digg' alt='Digg' /></a><a rel='nofollow' target='_blank'  href='http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;t=Create%20a%20shortcode%20for%20displaying%20the%20Loop'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/facebook.png' class='sociable-img sociable-hovers ' title='Facebook' alt='Facebook' /></a><a rel='nofollow' target='_blank'  href='http://www.friendfeed.com/share?title=Create%20a%20shortcode%20for%20displaying%20the%20Loop&amp;link=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/friendfeed.png' class='sociable-img sociable-hovers ' title='FriendFeed' alt='FriendFeed' /></a><a rel='nofollow' target='_blank'  href='http://reddit.com/submit?url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;title=Create%20a%20shortcode%20for%20displaying%20the%20Loop'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/reddit.png' class='sociable-img sociable-hovers ' title='Reddit' alt='Reddit' /></a><a rel='nofollow' target='_blank'  href='http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;title=Create%20a%20shortcode%20for%20displaying%20the%20Loop'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png' class='sociable-img sociable-hovers ' title='StumbleUpon' alt='StumbleUpon' /></a><a rel='nofollow' target='_blank'  href='http://technorati.com/faves?add=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/technorati.png' class='sociable-img sociable-hovers ' title='Technorati' alt='Technorati' /></a><a rel='nofollow' target='_blank'  href='http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;partner=sociable'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/pdf.png' class='sociable-img sociable-hovers ' title='PDF' alt='PDF' /></a><a rel='nofollow' target='_blank'  href='http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.wpfunc.com%2Fwordpress%2Fcreate-a-shortcode-for-displaying-the-loop.html&amp;partner=sociable'><img src='http://www.wpfunc.com/wp-content/plugins/sociable-30/images/default/16/printfriendly.png' class='sociable-img sociable-hovers ' title='Print' alt='Print' /></a><br/><br/>

<p>Related posts:<ol><li><a href='http://www.wpfunc.com/wordpress/create-pdf-button.html' rel='bookmark' title='Permanent Link: Create PDF Button'>Create PDF Button</a></li>
<li><a href='http://www.wpfunc.com/wordpress/add-numbers-next-to-each-post.html' rel='bookmark' title='Permanent Link: Add Numbers next to each post!'>Add Numbers next to each post!</a></li>
<li><a href='http://www.wpfunc.com/wordpress/create-custom-date-butons.html' rel='bookmark' title='Permanent Link: Create Custom Date Butons!'>Create Custom Date Butons!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wpfunc.com/wordpress/create-a-shortcode-for-displaying-the-loop.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
