29 Nov WP 101: WordPress Templates — How to Make Basic Edits
When it comes to themes and templates in WordPress terminology, for some users things can get a little bit confusing. Some web design systems often refer to the overall site design as a template. Below in this article we will explain exactly what a WordPress template is, and how to edit templates easily and quickly.
What is a WordPress Template?
In WP terminology, a template is actually a page layout which is available within a theme. So, just to be clear, a template is just a single page layout, and not the whole website design.
Some of the standard WP templates are usually common to almost all WP themes. For example, the Archive.php template can display a list of posts (within a date range, tag or a category), and the Single.php template displays single blog posts.
Template files are reusable, modular files which are used to generate the web pages on your WP website. Some of the template files, such as the footer and header template, are used on all pages of your site, while others are used under specific conditions.
Get 20% off on the Best WordPress Themes & Plugins
Some WordPress themes have only standard templates, while others have special templates, designed in order to deliver special design features. Your theme may have a full – width template with no sidebar or a special template for a contact page.
You can apply templates to individual pages in the page editor of your WordPress website. You just need to keep in mind that not all WP themes have special templates. If the theme you have installed on your website has special templates, you can find them in the page editor (page attributes box which is located to the right of your page content).
As previously mentioned, templates are actually layouts which were designed to work within a WP theme. You should be aware that you cannot install a single template. However, with a good understanding of web design (PHP, HTML and CSS), you can create your own custom templates, and create your website as per your taste and wishes.
Why You Might Want to Edit Your Templates?
In the WP theme development, a template actually defines a part of the web page which is generated by a WP theme. For example, header.php is a default template within WordPress themes. This template defines the header area of the web pages, and it should be loaded on every page of your WP website, allowing you to make changes to a single file which will apply across the entire website.
Most of the WP themes available have default templates with code to generate HTML output for particular website sections.
- index.php – Displays the main page of your website
- header.php- Displays the header section
- sidebar.php – Generates HTML output for the sidebar section
- footer.php – Displays the footer section of your website
- functions.php – Contains code and functions that will be used in your WP theme
- single.php – Displays the single post page
- comments.php – Displays comment form and comments
Templates may also be included into each other (like single.php can have included a sidebar, footer, header and content template). WP will allow you to ass as many templates as you like.
Each theme contains several different template files that control the appearance of particular sections or pages in your WP theme. You should edit your templates, as they are components of your WP theme, which controls how your website looks for your readers.
How to Edit Templates in WordPress?
Before making any changes to your WP theme, you should create a child theme, as it will protect your original theme files. Also, when you edit a child theme, you can undo your changes very fast and easy.
The easiest way to edit templates in WordPress is to copy it to your computer and paste it to your child theme folder. Afterwards, go back in your WP dashboard to Appearance > Editor, select your child theme, and the footer.php file name which is located in the right sidebar. Then, click the Update File beneath the editor.
This is a very basic edit, but it should give you a good framework for more complex edits. You can always delete the edited files from your child theme, and it will automatically revert to the original file. This is why using a child theme when doing edits is important, as you can always undo your edits without deleting any content from your website.
Thank you for reading this article. If you need any additional help, or you have any questions regarding this subject, please do not hesitate to contact us below in comments, and we will do our best to help you in any way we can.