List of standard theme template files

Below is a list of standard template files used by WordPress. Of course, your theme may also contain other style files, images, or programs. Just keep in mind that the file names below have special meaning for WordPress – see Template Hierarchy for more information.

style.css
The main stylesheet file. The file must be in the theme and must contain the comments described above in the file header.

index.php
Main template file. If you use your own templates in your theme, this index.php file is mandatory.
comments.php
Template for comments. If you don’t have one, you’ll use the default comments.php file from your theme.

comments-popup.php
Adds a popup menu for JS comments. If it’s absent, comments-popup.php is called from the default theme.

home.php
Blog home page template.

single.php
The single post page template. This is used when a specific post is requested. For this and other post request templates, index.php is used if your theme does not have a corresponding template file.

page.php
Single page template, used to display the requested Page.

category.php
Category category template. Used when requesting a category.

author.php
Blog author template. Used when requesting an author for the blog.

date.php
Template for displaying the date/time. Used when requesting the date and time. Year, month, day of the month, hour, minute, second.

archive.php
Archive template. Used when a category, author, or date is requested. Note that this template can be overridden by templates category.php, author.php and date.php for the corresponding types of requests.

search.php
Search result template. Used after a search.

404.php
Template for a 404 Not Found error message. Used when WordPress can’t find a post or page that matches the query.

These files have a special meaning in WordPress because they are used to replace index.php when it is in the theme directory, according to the Template Hierarchy, and when a matching request is received; or according to the truth of Conditional Tag, when a function like is_*(); returns ‘true’.

For example, if you want to display a single post, is_single() returns ‘true’, and the active theme directory has a single.php template file, this template is used to create the page.

© 2024 Child theme Configurator - WordPress Theme by WPEnjoy