WordPress Theme Basics
A WordPress theme is a collection of WordPress templates made up of WordPress template tags. A WordPress theme refers to the group of templates that makes up the theme. A WordPress template refers to only one of the template files that contain WordPress template tags. WordPress template tags make all the templates work together as a theme.
Understanding theme structure
Here is an overview of the templates that make up a WordPress theme and where you find them, both on your server and within your WordPress Dashboard. Follow these steps:
Connect to your web server via FTP and have a look at the existing WordPress themes on your server.
The correct location is /wp-content/themes/. When you open this folder, you find the /twentyfourteen theme folder.
If a theme is uploaded to any folder other than /wp-content/themes, it won’t work.
Open the folder for the Twenty Fourteen theme (/wp-content/themes/fourteen) and look at the template files inside.
When you open the Twenty Fourteen theme folder, you see several files. At minimum, you find these five templates in the default theme:
Header template (header.php)
Main Index (index.php)
Sidebar template (sidebar.php)
Footer template (footer.php)
These files are the main WordPress template files. There are several template files, however, and you should try to explore all if you can. Take a peek inside and see the different template functions they contain. These filenames are the same in every WordPress theme.
Click the Editor link on the Appearance menu to look at the template files within a theme.
This Edit Themes page lists the various templates available within the active theme. A text box on the left side of the screen displays the contents of each template, and this box is also where you can edit the template file(s). 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 HTML markup and template tags within the template file. These tags make all the magic happen in your blog; they connect all the templates to form a theme.
Below the text box on the Edit Themes page is a drop-down menu labeled Documentation. Click the arrow on the right side of the menu, and a list drops down that contains all of 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 some of the different template tags used to create functions and features within your WordPress theme. (Note: The Documentation menu does not appear when you view the Stylesheet because no template tags are used in the style.css template — only CSS.)
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, you use template tags to pull the information from each template — Header, Sidebar, and Footer — into the Main Index.