I prepared the following discussion on researching and learning WordPress as a part of Jesse Friedman’s book The Web Designer’s Guide to WordPress: Plan, Theme, Build, Launch.
Learning any new technology can be daunting, and WordPress is no exception. Though the admin interface is rather intuitive and accessible, it belies a power that can be difficult to fully grasp for new developers. Now that Jesse has provided the foundational understanding needed to begin developing WordPress themes, you’re probably wondering how you expand your knowledge beyond the methodologies and functions you’ve just learned.
The best place to start is the WordPress Codex at http://codex.wordpress.org. This wiki, maintained by the WordPress Community (which now includes you), covers many of the common WordPress APIs (functions, classes, etc) organized into two primary categories: Function Reference (http://codex.wordpress.org/Function_Reference) and Template Tags (http://codex.wordpress.org/Template_Tags). As the category names imply, the information found under the former pertains mostly to aspects of WordPress that don’t relate directly to front-end output whereas the latter encompasses those functions that do. Put simply, if a function name starts with the_, it echoes something and is classified under Template Tags. For example,
the_title() is considered a Template Tag, whereas
get_the_title() is found under Function Reference; the former echoes the title, whereas the latter returns it. This is all well and good, but what if you don’t even know where to start?
The WordPress.org Support Forums at http://wordpress.org/support/ are a great place to begin researching the problem you’ve encountered or the question you have. Like the Codex, this is a community-maintained resource covering topics ranging from installing WordPress to utilizing custom post types and taxonomies. The WordPress Answers site on StackExchange (http://wordpress.stackexchange.com) is another excellent resource that, like the Support Forums, is regularly visited by everyone from beginning developers to WordPress experts and even Core Contributors. Looking for general tutorials? Start with a trustworthy source, such as WPCandy (http://wpcandy.com/category/teaches) or iThemes (http://ithemes.com/tutorials/). Another often-overlooked resource is WordPress.tv, which hosts exclusively WordPress-related videos from WordCamps, WordPress meetups, and the like. Nearly every WordCamp includes some sort of beginner or introductory track, as well as varying levels of more-advanced presentations, meaning you’ll likely have no trouble finding videos relevant to your needs and interests. Inevitably, your skills will develop to a point where existing tutorials and videos, as well as the Codex, will be insufficient resources. Once you’ve reached this point, you’re ready to start learning WordPress from itself. In other words, it’s time to delve into Core.
Before you panic, know that this sounds far more intimidating than it actually is. WordPress Core is, thankfully, quite well organized. The bulk of its functionality is found in the
wp-includes folder, while anything specific to administration is found in
wp-includes, PHP files fall into three categories: those that contain template-specific functions, those that contain the functions underpinning template functions, and those that contain classes. For example, code related to retrieving post-specific data, such as
get_the_title(), are in post.php, whereas its template counterpart
the_title() is in
post-template.php. Most functions for creating and managing categories are found in
category.php, while functions for displaying category-related information in your theme exist in category-template.php. Wondering where WordPress’ functions for querying the database for posts are found? Check out
query.php. Working with permalinks?
rewrite.php is your destination. Feed functions (for RSS, Atom, etc) are in feed.php, while their corresponding templates are named
feed-[feed type].php. Lastly, before discussing the “catch all” files, almost everything related to WordPress Multisite (formerly WordPress MU) exists in files prefixed with mu-.
One common area of frustration when first exploring
wp-includes arises when you cannot locate a function you know exists. Perhaps you read about it in the Codex or have seen it used in a theme, but it just doesn’t appear where you’d expect. In this situation, there are three files to check:
pluggable.php. Each of these files contains a collection of functions that either don’t fall specifically into a category covered by one of the other files, are generic enough to fit multiple categories, or that, in the case of pluggable.php, are made available for plugins to override. Even after years of developing site on WordPress, I still occasionally forget that a function is in one of these files, leading to some amount of frustration. When that happens, head over to http://phpxref.ftwr.co.uk/wordpress/, where you can search for and locate the function in question. This resource, the WordPress Crossreference, is provided by Peter Westwood, a Core contributor, and updates nightly to reflect the latest changes in WordPress. It’s all pretty logical, right? Excellent. One last note on organization: there is an entire category of files in wp-includes that I’ve skipped over, that of the class- naming convention; I could write another 1,000 words on those files alone, but in brief, they encompass some of the more-complex WordPress APIs that are comprised of many interdependent functions. Now that you know where to find the functionality you seek, you may be wondering how you’ll know how to use the functions once you find them. Thankfully, much of Core is well-documented by way of PHPDoc.
Preceding the majority of function definitions is a comment block that details the function’s intended use, accepted arguments, and expected results. WordPress-specific dependencies are also identified, as are the global variables a function invokes. Without needing to read a line of the function definition itself, one gains rather clear insight into how to employ a given function. References such as Peter Westwood’s aforementioned Crossreference, or WordPress’ own documenter at http://phpdoc.wordpress.org/, leverage the same PHPDoc, ensuring synchronicity with WordPress itself. Though occasionally missing, most recent changes have been documented, and each revision of WordPress adds further completeness to its inline documentation.
Though brief, with any luck, the foregoing discussion has alleviated some of your concern and confusion regarding advancing your WordPress skills by building on the foundation Jesse has provided over the course of this book. As I hope you’ve learned, there are many reliable resources for learning WordPress, but none as detailed as Core itself.