<?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>CSSReflex &#187; template tags</title> <atom:link href="http://www.cssreflex.com/tag/template-tags/feed" rel="self" type="application/rss+xml" /><link>http://www.cssreflex.com</link> <description>The CSSReflex blog covers all of Tutorials, Design News, Web Development, Showcases, Freebies, WordPress Tutorials And Blogger Templates.</description> <lastBuildDate>Wed, 08 Sep 2010 02:51:13 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=abc</generator> <item><title>Top 10 WordPress Codes Every Designer Should Know</title><link>http://www.cssreflex.com/2009/08/top-10-wordpress-codes-every-designer-should-know.html</link> <comments>http://www.cssreflex.com/2009/08/top-10-wordpress-codes-every-designer-should-know.html#comments</comments> <pubDate>Fri, 07 Aug 2009 05:00:22 +0000</pubDate> <dc:creator>Naeem Noor</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[Code]]></category> <category><![CDATA[Code Snippets]]></category> <category><![CDATA[template tags]]></category><guid isPermaLink="false">http://www.cssreflex.com/?p=586</guid> <description><![CDATA[Hello there! Here I collected a very great collection of 10 WordPress codes that I consider the most commonly used by any WordPress developer. The content was reformatted for quick reference from the Template Tag section of the WordPress.org Codex, a relative encyclopedia to WordPress themeing, and great reference for your WordPress questions. You may [...]]]></description> <content:encoded><![CDATA[<p>Hello there! Here I collected a very great collection of 10 WordPress codes that I consider the most commonly used by any WordPress developer. The content was reformatted for quick reference from the Template Tag section of the <a href="http://codex.wordpress.org/Template_Tags" target="_blank">WordPress.org Codex</a>, a relative encyclopedia to WordPress themeing, and great reference for your WordPress questions.</p><p><a href="http://www.cssreflex.com/wp-content/uploads/2009/08/most-commonly-used-wordpress-code-snippets.jpg"><img class="aligncenter size-full wp-image-559" title="wp-code" src="http://www.cssreflex.com/wp-content/uploads/2009/08/most-commonly-used-wordpress-code-snippets.jpg" alt="wp-code" width="490" height="182" /></a></p><p><strong>You may be interested in these older posts</strong><a title="13 Magnificent Free WordPress Portfolio Themes" href="http://www.cssreflex.com/2009/07/13-magnificent-free-wordpress-portfolio-themes.html"><br /> 13 Magnificent Free WordPress Portfolio Themes</a><br /> <a title="15 Free Awesome Social Bookmark Icons Sets" href="http://www.cssreflex.com/2009/06/15-free-awesome-social-bookmark-icons-sets.html">15 Free Awesome Social Bookmark Icons Sets<br /> </a><a title="5 Essential Google Cheat Sheets Which Surely Will Come in Handy" href="http://www.cssreflex.com/2009/07/5-essential-google-cheat-sheets-which-surely-will-come-in-handy.html" target="_self">5 Essential Google Cheat Sheets Which Surely Will Come in Handy</a></p><p>Here are the list of most commonly used WordPress code snippets by designers. If I&#8217;ve missed any WordPress code, please comment below.</p><h3>Display Recent Posts</h3><p><code class="html">&lt;?php wp_get_archives('type=postbypost&amp;limit=5'); ?&gt;</code><br /> or</p><p><code class="html">&lt;?php  $recentposts = get_posts('numberposts=12&amp;category=4');<br /> foreach ($recentposts as $post) :  	setup_postdata($post);  ?&gt;<br /> &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;  &lt;?php endforeach; ?&gt;</code></p><h3>Display Categories</h3><p><code class="html">&lt;h2&gt;Categories&lt;/h2&gt;<br /> &lt;ul&gt;<br /> &lt;?php wp_list_cats('sort_column=name'); ?&gt;<br /> &lt;/ul&gt;</code></p><h3>Display Archives</h3><p><code class="html"> &lt;h2&gt;Archives&lt;/h2&gt;<br /> &lt;ul&gt;<br /> &lt;?php wp_get_archives('type=monthly'); ?&gt;<br /> &lt;/ul&gt;</code></p><h3>Display WordPress Tags Cloud</h3><p><code class="html"> &lt;?php wp_tag_cloud('smallest=8&amp;largest=36&amp;'); ?&gt;</code></p><h3>Display Blogroll</h3><p><code class="html">&lt;ul&gt;  &lt;?php wp_list_bookmarks('title_li=&amp;categorize=0'); ?&gt;  &lt;/ul&gt;</code></p><h3>Display WordPress Tags</h3><p><code class="html"> &lt;?php the_tags(); ?&gt;</code></p><h3>Display a Pages Menu</h3><p><code class="html">&lt;h2&gt;Pages&lt;/h2&gt;<br /> &lt;ul&gt;<br /> &lt;?php wp_list_pages('title_li='); ?&gt;<br /> &lt;/ul&gt;</code></p><h3>Display Recent Comments</h3><p><code class="html">&lt;?php<br /> global $wpdb;<br /> $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,<br /> comment_post_ID, comment_author, comment_date_gmt, comment_approved,<br /> comment_type,comment_author_url,<br /> SUBSTRING(comment_content,1,30) AS com_excerpt<br /> FROM $wpdb-&gt;comments<br /> LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =<br /> $wpdb-&gt;posts.ID)<br /> WHERE comment_approved = '1' AND comment_type = '' AND<br /> post_password = ''<br /> ORDER BY comment_date_gmt DESC<br /> LIMIT 10";<br /> $comments = $wpdb-&gt;get_results($sql);<br /> $output = $pre_HTML;<br /> $output .= "\n&lt;ul&gt;";<br /> foreach ($comments as $comment) {<br /> $output .= "\n&lt;li&gt;".strip_tags($comment-&gt;comment_author)<br /> .":" . "&lt;a href=\"" . get_permalink($comment-&gt;ID) .<br /> "#comment-" . $comment-&gt;comment_ID . "\" title=\"on " .<br /> $comment-&gt;post_title . "\"&gt;" . strip_tags($comment-&gt;com_excerpt)<br /> ."&lt;/a&gt;&lt;/li&gt;";<br /> }<br /> $output .= "\n&lt;/ul&gt;";<br /> $output .= $post_HTML;<br /> echo $output;?&gt;</code></p><h3>Display Admin Section</h3><p><code class="html">&lt;ul&gt;<br /> &lt;?php wp_register(); ?&gt;<br /> &lt;li&gt;&lt;?php wp_loginout(); ?&gt;&lt;/li&gt;<br /> &lt;li&gt;&lt;a href="http://www.wordpress.org/"&gt;WordPress&lt;/a&gt;&lt;/li&gt;<br /> &lt;?php wp_meta(); ?&gt;<br /> &lt;li&gt;&lt;a href="http://validator.w3.org/check?uri=referer"&gt;XHTML&lt;/a&gt;&lt;/li&gt;<br /> &lt;/ul&gt;</code></p><h3>Display Top Comments</h3><p><code class="html">&lt;?php $result = $wpdb-&gt;get_results("SELECT<br /> comment_count,ID,post_title FROM $wpdb-&gt;posts ORDER BY comment_count<br /> DESC LIMIT 0 , 10");<br /> foreach ($result as $topten) {<br /> $postid = $topten-&gt;ID;<br /> $title = $topten-&gt;post_title;<br /> $commentcount = $topten-&gt;comment_count;<br /> if ($commentcount != 0) { ?&gt;<br /> &lt;li&gt;&lt;a href="&lt;?php echo get_permalink($postid); ?&gt;"<br /> title="&lt;?php echo $title ?&gt;"&gt;&lt;?php echo $title<br /> ?&gt;&lt;/a&gt;&lt;/li&gt;<br /> &lt;?php } } ?&gt;</code></p> ]]></content:encoded> <wfw:commentRss>http://www.cssreflex.com/2009/08/top-10-wordpress-codes-every-designer-should-know.html/feed</wfw:commentRss> <slash:comments>61</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching using disk
Object Caching 125/248 objects using disk

Served from: www.cssreflex.com @ 2010-09-09 05:04:55 -->