WordPress Cheat Sheet For Commonly Used Template Functions

If you find yourself constantly referring to the Codex or searching for a commonly used template function, consider bookmarking this WordPress Cheat Sheet created by Trevor Niemi. Launched in February of this year, Niemi created the site after seeing a pixelated image of the same information published to Reddit. When asked how often the site is updated, Niemi says he’s “actively updating it when Codex changes occur and when a good suggestion is submitted by a user.”

The cheat sheet has a listing of functions you can copy and paste into your work. Several of the functions are linked to their corresponding Codex pages for more information and general usage. There’s also a PDF link making it easy to save and view the information offline.

WP Cheat Sheet In Action

When asked whether the site would expand to cover more information, Niemi responded, “future thinking, or expanding, is tricky. I really don’t want to alienate the user base by trying to churn a profit or anything like that because of how fickle developers are in general when things change and the nature of what a simple cheat sheet should provide a user.” Although he has some ideas, he hasn’t been able to dedicate time or attention to the site.

Since the site launched, WP-Cheatsheet has received 15,000 total visits with an average of 100 per day. Niemi says, “the site has become a fun, no stress project that I think people actually use which makes me happy”.

If you’re looking for more code resources, we recently wrote about the launch of the official WordPress code reference site. Also take a look at Hookr.io to see an alternative approach to viewing the code that powers WordPress.

3 Comments


  1. Cheat sheets are great, but there’s too much incorrect (or confusing) about this one to promote it. These are the ones that jump out at me:

    As noted above, index.php is not the “home page file”. Getting that so badly incorrect gives me pause to trust anything else in the cheat sheet.

    Generally, home_url() is a better choice than site_url(). (See also bloginfo( ‘url’ ))

    There is no explanation of the difference between template and stylesheet directories, or when to use/reference which one.

    bloginfo( ‘stylesheet_url’ ) simply calls get_stylesheet_uri(), which should simply be called directly.

    bloginfo( ‘template_url’ ) simply calls get_template_directory_uri(), which should be called directly.

    Calls to wp_nav_menu() should use the template_location parameter, rather than the menu parameter.

    TEMPLATEPATH is slated for deprecation; use get_template_directory() instead. And when including template-part files, use get_template_part() instead of include().

    Report


    1. Sorry about that. I’ve reached out to the author of this cheat sheet to respond to your comments. Hopefully, they update the information on the site based on feedback here.

      Report

Comments are closed.