<?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; CMS</title>
	<atom:link href="http://wpfunc.com/tag/cms/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>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>
	</channel>
</rss>

