How to View the Template Files in a WordPress Theme - dummies

How to View the Template Files in a WordPress Theme

By Lisa Sabin-Wilson

A WordPress theme is a collection of WordPress templates made up of WordPress template tags. A WordPress theme means the group of templates that makes up the theme. A WordPress template refers to only 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:

1Connect 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 /twentythirteen theme folder.

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

2Open the folder for the Twenty Thirteen theme (/wp-content/themes/twentythirteen) and look at the template files inside,

When you open the Twenty Thirteen 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.

3On 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).

4To 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. These tags 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.