The Basics of WordPress Themes
A WordPress theme is a collection of WordPress templates made up of WordPress template tags. Theme refers to a group of templates that makes up the theme. 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.
WordPress theme structure
Here is a brief 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 /twentyeleven 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 Eleven theme (/wp-content/themes/twentyeleven) and look at the template files inside.
When you open the Twenty Eleven 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, 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.