If you've been developing themes, or taking a go at modifying your own, chances are you'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're just stepping into the wonderful world of modifying your blog, it's worth a look.
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 "drag and drop".
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 WordPress Function Reference 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.
The page is chock full of things like "in_category()", 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 "wp_insert_post()", which you can use to insert posts "manually", 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.
What I'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's ID. It returns 0 if there is an error, but more importantly, if you pass an existing user'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's very handy that inserting a user is so flexible.
If you're just jumping into these functions you'll find them quite easy to use, while giving you a lot of control. If you're an experienced PHP programmer you'll find you'll program less, and you'll also appreciate the work going into WordPress a lot more!Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.