As I'm sure you're probably aware, themes are made up of many different files, each of which play their respective part in the displaying or functionality of a theme. Let's have a look at some of the most common files WordPress recognizes by default that we'll be dealing with. Most files are self explanatory by their name alone:
header.php
Usually this file contains our theme up until </head>, it also plays home to the wp_head() function, which is one of the most essential hooks in WordPress.
sidebar.php
An optional file called by the use of get_sidebar(), you can use this file for a sidebar, navigation or anything similar. This is also where you will usually include the code to allow widgets to run, if your theme allows them.
footer.php
An easy part to guess, this is where the theme wraps up and also where you can register a second area for widgets to display. Of course you can display widgets anywhere you want, but sidebar and footer are the most common.
page.php
Used to display a single page - not to be confused with a post.
single.php
The post file, used to display a single blog post but very similar to page.php in code.
index.php
As you can probably guess, index does the chunk of the work for a blog; displaying posts, search results, serving up error messages and so on.
functions.php
The functions file may be new to you. This is where theme specific functions are stored - most commonly the functions to register widget ready areas.
comments.php
Displays a loop similar to index.php which iterates through comments. This is also where trackbacks, nested comments and other related functionality is performed.
A theme can use as many or as few theme files as desired, but these are the files most common to almost every theme. Theme file structure is essentially the decision of the theme developer - for example there could be vimeo.php, youtube.php and audio.php that display their respective post types rather than having all of the code bundled in to one page.php or single.php.
No comments:
Post a Comment
Please Comment Here!