<?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>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; template tags</title> <atom:link href="http://www.ghacks.net/tag/template-tags/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Fri, 10 Feb 2012 20:51:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Do more with your WordPress using the function reference</title><link>http://www.ghacks.net/2009/08/26/do-more-with-your-wordpress-using-the-function-reference/</link> <comments>http://www.ghacks.net/2009/08/26/do-more-with-your-wordpress-using-the-function-reference/#comments</comments> <pubDate>Wed, 26 Aug 2009 06:19:54 +0000</pubDate> <dc:creator>Daniel Pataki</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[functions]]></category> <category><![CDATA[template tags]]></category> <category><![CDATA[wordpress]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=15746</guid> <description><![CDATA[If you&#8217;ve been developing themes, or taking a go at modifying your own, chances are you&#8217;ve run into the WordPress Template Tags page. This part of the WordPress Codex lists numerous functions you can use to customize your themes quickly and easily, even if you&#8217;re just stepping into the wonderful world of modifying your blog, [...]]]></description> <content:encoded><![CDATA[<p><img
class="alignleft size-full wp-image-15748" src="http://www.ghacks.net/wp-content/uploads/2009/08/wordpress.gif" alt="wordpress" width="166" height="142" />If you&#8217;ve been developing themes, or taking a go at modifying your own, chances are you&#8217;ve run into the <a
href="http://codex.wordpress.org/Template_Tags">WordPress Template Tags</a> page. This part of the WordPress Codex lists numerous functions you can use to customize your themes quickly and easily, even if you&#8217;re just stepping into the wonderful world of modifying your blog, it&#8217;s worth a look.</p><p>Among other things, it allows you to add category lists, show comment ID-s, show comment authors, display next image links, add a dropdown box of categories anywhere, useful, and basically &#8220;drag and drop&#8221;. There is however another great WordPress reference which is a bit more obscure, but also contains a huge load of functions for some other tasks you might have around your site. The <a
href="http://codex.wordpress.org/Function_Reference">WordPress Function Reference</a> section of the codex lists at least 250-300 functions for pages, authors, plugin usage, comments, users, etc, in short, encompassing the whole blog platform, as opposed to more blog post oriented functions in the Template Tags section.</p><p><span
id="more-15746"></span></p><p>The page is chock full of things like  &#8220;in_category()&#8221;, which if passed a post ID and a category, will tell you if that post is in the category or not. Great if you want to display category specific content on your main page for example. It also gives you real power, with functions like &#8220;wp_insert_post()&#8221;, which you can use to insert posts &#8220;manually&#8221;, by passing an array of info to the function. Similarly you can use wp_insert_user() to add a user, with the parameters you want. Very useful for creating some custom sign up forms, custom permissions and so on.</p><p>What I&#8217;ve come to appreciate while using these functions is how very well WordPress is thought out. I sort of knew this 3 years ago when I started, but when I began to use these functions I realized why. For example, wp_insert_user() will insert a new user, and will return the new user&#8217;s ID. It returns 0 if there is an error, but more importantly, if you pass an existing user&#8217;s ID, it will update that user, instead of creating a new one. There is a separate wp_update_user() function, but the action they perform is so close, it&#8217;s very handy that inserting a user is so flexible.</p><p>If you&#8217;re just jumping into these functions you&#8217;ll find them quite easy to use, while giving you a lot of control. If you&#8217;re an experienced PHP programmer you&#8217;ll find you&#8217;ll program less, and you&#8217;ll also appreciate the work going into WordPress a lot more!</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/08/26/do-more-with-your-wordpress-using-the-function-reference/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>WordPress template tags you should know</title><link>http://www.ghacks.net/2009/03/29/wordpress-template-tags-you-should-know/</link> <comments>http://www.ghacks.net/2009/03/29/wordpress-template-tags-you-should-know/#comments</comments> <pubDate>Sun, 29 Mar 2009 14:41:55 +0000</pubDate> <dc:creator>Daniel Pataki</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[php]]></category> <category><![CDATA[template tags]]></category> <category><![CDATA[wordpress]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=11529</guid> <description><![CDATA[If you run a WordPress blog, you will eventually want to make some modifications to your theme. Perhaps you want to show your tags, not just categories, perhaps you want the date in a different format, you might want to add the URL of the author to each post, there are a lot of things [...]]]></description> <content:encoded><![CDATA[<p>If you run a WordPress blog, you will eventually want to make some modifications to your theme. Perhaps you want to show your tags, not just categories, perhaps you want the date in a different format, you might want to add the URL of the author to each post, there are a lot of things like that which can easily be done with a little knowledge of <a
title="wordpress tags" href="http://codex.wordpress.org/Template_Tags" target="_blank">WordPress template tags</a>, which are little PHP code snippets, but you don&#8217;t have to be a coder to use them.</p><p>The great thing about these tags is that they are very well documented &#8220;see link above&#8221;, and that they are extremely simple to use. You don&#8217;t need to know anything about PHP, so let me explain their basic use in common sense language. WordPress uses a loop, elegantly called &#8220;the loop&#8221; in &#8220;WordPressian&#8221;, which cycles through the posts you have.</p><p>If you show 10 posts on your main page, the loop cycles through the latest 10 posts. This means that one the first loop it will pull in the data of your latest post, on the second pass it will look at the second and so on. All the data is pulled, all you need to do is specify what you want to display out of that data, let&#8217;s take a look at how.</p><p><span
id="more-11529"></span></p><p>First of all, you need to identify the start and the end of the loop. The loop starts with the following (there may be some variation) :</p><p>&lt;?php if(have_posts()) : ?&gt;<br
/> &lt;?php while(have_posts()) : the_post(); ?&gt;</p><p>And ends with a &#8220;&lt;?php endwhile; ?&gt; &lt;?php endif; ?&gt;&#8221;. This end statement is usually followed by the page navigation links which let you &#8220;turn the page&#8221; to the next or previous posts. Anything inside the loop gets executed as many times as the number of posts which are shown.</p><p>If all you want is to show your title, you just need to put &#8220;&lt;?php the_title() ?&gt;&#8221;, and you will get the titles of your first 10 posts. If you also want to show the tags you can add &#8220;&lt;?php the_tags() ?&gt;&#8221;. There are many others you can add, and don&#8217;t forget, you also need some HTML and CSS to make them look good.</p><p>Here&#8217;s a list of the most basic ones and what they do, but you can see the full list and expanded usage by clicking on the link above. Remember that the following should be put in the form: &lt;?php function() ?&gt;</p><ul><li>the_title() &#8211; outputs the title of the</li><li>the_content() &#8211; displays the actual post body</li><li>the_category() &#8211; displays the categories the post is in</li><li>the_tags() &#8211; displays the tags for the post</li><li>the_author &#8211; outputs the post author&#8217;s name</li><li>the_author_url &#8211; outputs the link to the author&#8217;s page, used a lot in links with &#8220;the_author&#8221;</li><li>the_time() &#8211; outputs the time of the post, you need to add the format in the parenthesis</li><li>the_permalink &#8211; outputs the posts permalink, usually used in a link with &#8220;the_title&#8221;</li></ul><p>While I use many others now and again, there are loads of designs that only use these 8, you can do a lot, with these alone. As you can see, adding to and modifying a WordPress template is not such a big deal, why not try it yourself?</p><p><img
class="alignleft size-full wp-image-10878" src="http://www.ghacks.net/wp-content/uploads/2009/03/scrip_twitter.gif" alt="Script" width="53" height="53" /><strong>If you&#8217;d like to read some similar articles, take a look at <a
title="Web development blog" href="http://www.bluehost.com/cgi/suspended?d=scriptastique.com">Scriptastique</a>, a blog all about web development and coding, with great tips on CSS, HTML, PHP, MySQL and Javasctipt and tutorials and screencasts coming soon! You can follow us on our <a
title="Scriptastique RSS feed" href="http://feeds2.feedburner.com/scriptastique">RSS feed</a>, or <a
title="Scriptastique on Twitter" href="http://twitter.com/scriptastique">Twitter</a> and <a
title="Scriptastique on Facebook" href="http://www.facebook.com//login.php">Facebook</a>! </strong></p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/03/29/wordpress-template-tags-you-should-know/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
