3 Comments

  1. Sal Ferrarello

    I’d suggest updating the index.php description. Rather than “home page file” something like “default template if no other template matches” would be more accurate. My go to for template hierarchy is this awesome reference on the Codex, https://codex.wordpress.org/Template_Hierarchy

    Report

  2. Chip Bennett

    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

    • Jeff Chandler

      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.

%d bloggers like this: