How to View Template Files in the WordPress Twenty Fifteen Theme - dummies

How to View Template Files in the WordPress Twenty Fifteen Theme

By Lisa Sabin-Wilson

A WordPress theme is a collection of WordPress templates made up of WordPress template tags. A WordPress theme is the group of templates that makes up the theme. A WordPress template is one of the template files that contains WordPress template tags. WordPress template tags make all the templates work together as a theme.

Here is a brief overview of the templates that make up a WordPress theme and where you find them, both on your server and on your WordPress Dashboard. Follow these steps:

  1. Connect to your web server via FTP and look at the existing WordPress themes on your server in the folder /wp-content/themes.

    When you open this folder, you find the /twentyfifteen theme folder.

    If a theme is uploaded to any folder other than /wp-content/themes, it won’t work.

  2. Open the folder for the Twenty Fifteen theme (/wp-content/themes/twentyfifteen) and look at the template files inside.

    /wp-content/themes folder.” width=”535″/>
    Themes in the /wp-content/themes folder.

    When you open the Twenty Fifteen theme folder, you see several files. At a minimum, you find these five templates in any theme:

    • Stylesheet (style.css)

    • Header template (header.php)

    • Main Index (index.php)

    • Sidebar template (sidebar.php)

    • Footer template (footer.php)

    These files are the main WordPress template files. Take a peek inside these files and see the different template functions they contain. These filenames are the same in every WordPress theme.

  3. On your WordPress Dashboard, choose Appearance → Editor to look at the template files within a theme.

    The Edit Themes page appears and lists the various templates available within the active theme. A text box in the center of the screen displays the contents of each template, and this box is also where you can edit the template file(s).

    A list of templates available in the default Twenty Fifteen WordPress theme.
    A list of templates available in the default Twenty Fifteen WordPress theme.
  4. To view and edit a template file, click the template name in the list on the right side of the page.

The Edit Themes page also shows the template tags within the template file. Template tags contain specific theme functions that make all the magic happen in your site; they connect all the templates to form a theme.

Below the text box on the Edit Themes page is the Documentation drop-down list for every file you edit, except style.css. Click the arrow on the right side of the menu, and a list drops down that contains all the template tags used in the template you’re currently viewing. This list is helpful when you edit templates, and it gives you some insight into the different template tags used to create functions and features within your WordPress theme.

The template files don’t work alone; for the theme to function, the files need one another. To tie these files together as one working entity, use template tags to pull the information from each template — Header, Sidebar, and Footer — into the Main Index.