The Basics Of Customizing Wordpress Templates
The Basics Of Customizing Wordpress Templates
Do you want to change the look of your WordPress site or maybe to put something like a banner or adsense code on your blog? In order to do this you need to know about three important things: template files, functions and CSS.
- Template Files
These files are stored in a directory (wp-content/themes/template-name/). So if you are using "default theme", you need to access the files that are stored in "wp-content/themes/default/" directory.
There are several common WordPress template files you should know:
1.header.php
This file is responsible for the appearance of the top section of your blog. If you want to change the header image, you have to access this file. Not only that, this file is also the place to add Meta Tags.
2.footer.php
Similar to the header.php, this file is loaded everytime any page or post of your blog is accessed. It is used to store the HTML tags and the code for the bottom section of your blog.
3.sidebar.php
A sidebar is a section which is usually used to display site navigation. Depending on the theme you are using, a sidebar usually provides links to archives, pages and latest posts.
4.index.php
In fact this file is the main template file. When someone visits the homepage of your blog site, this file will be loaded. Then he/she will see the contents (not the source code) of this file. If you want to make the appearance of your blog become similar to a common website, where there is a static description on the homepage, you may try to put the static content in this file.
Besides those files, a theme usually has some other template files with different purposes. For example, the archives.php is a file used to display posts you made in the past. Then the search.php is used to generate search results.
- Functions
A function is a blog of code to accomplish a specific task. In order to modify template files, you don't need to master any programming language. Although having a little knowledge in PHP, you can work faster. In WordPress, the name of a function is usually related to its purpose. For instance, "the_title()" is a function to display the title of a post and "the_content()" is used to display its content. Another example is "blog_info()" which is responsible for displaying the name or description of your blog, depending on the given argument (additional data).
- CSS
Style Sheet is a facility to manage the format and layout of a website efficiently. Without using it, changing small things such as the font type or the background color of all of your webpages is a daunting task where you have to do it page by page. But with the existence of style sheet, one change you make can affect the whole site. You should know that in WordPress a different theme may have a different css file. You also need to know that some styles may be defined in the header.php file. If you are using the "default theme", you have to access the header.php file in order to change the background color or the header image of your blog, not the css file.
Finally, before you customize the templates, it is highly recommended to backup any files you intend to change. If something doesn't work properly, you can always go back to the original settings.
Heris Yunora is the owner of unlimitedhostingplan.com, a website that contains information on multiple domain hosting with features such as unlimited subdomain, databases, and unlimited email accounts.