Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Template Hierarchy

Template Hierarchy

Intro to the WordPress Template System.

WordCamp Columbus

Caleb Burks

July 17, 2015
Tweet

More Decks by Caleb Burks

Other Decks in Programming

Transcript

  1. ABOUT ME ▸ Caleb Burks ▸ WC Ninja at Automattic

    ▸ Loves Gummy Bears ▸ Tweets at @WPprodigy
  2. STYLE.CSS /* Theme Name: My Theme Theme URI: http://awesometheme.com Author:

    Caleb Burks Author URI: http://author.com Description: Blah Blah License: GNU General Public License v3 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: storefront */
  3. MAIN TEMPLATES: PAGE ▸ front-page.php - static homepage ▸ page.php

    - backup for front-page.php ▸ singular.php - Fallback (new)
  4. OTHER CONTENT TEMPLATE PARTS content-single.php for single posts. content-page.php for

    single pages. content-search.php for results from searches.
  5. SEARCH.PHP Displays a list of posts/pages based on search query.

    ▸ Include the search form again ▸ get_search_form()
  6. CUSTOM TEMPLATES: ARCHIVES ▸ category-$slug.php ▸ category-$id.php ▸ tag-$slug.php ▸

    tag-$id.php Applies to authors, taxonimies, and CPT's as well.
  7. CUSTOM TEMPLATES: PAGES How to create a custom home page

    template: 1. Copy page.php 2. Rename it to page-home.php 3. Add the following comment to the top: 4. Template Name: Homepage