Wordpress is open source platform famous for
its blogging functionality. Wordpress is also known for its flexibility to
customize the site or blog created by Wordpress. First step to customize the Wordpress
based blog or site is to make changes in its theme/ template or to create new
template or themes. Customization of
template is more important in Wordpress, it can give new look to your site and
make it attractive. Template files are building block for your site in Wordpress.
Suppose, you have created your site or blog
and you want to make your home page or welcome page to be look different ad
make it attractive then other pages of
your site this could be accomplished by creating new custom template page
only. Templates are core part of the Wordpress
as they give lot more functionality to your site. You can create new template
file and can make it useful to create pages of your Wordpress based in
different way and allow adding lot more feature and functionality.
Templates can be used for specific pages or
can be used for only specific conditions. Generally if you see typical webpage
it contains XHTML and CSS file, same thing with the Wordpress too but the main
contents of site are generated by different template files, this template files
and CSS style sheet combined to work as Wordpress Theme. These template files
get information from your Wordpress MySql database and then generate the HTML
code which is then sent to web browser of user.
Basic of template:
-Template structure basically contains Header, Content and Footer. Header
contains the information to be display on the top of your site. Content
contains the post or pages of your blog. Footer contains the information to be
displayed at the bottom of your site.
-Basic template file is index.php which you can find in your site’s Wordpress
theme directory. Index.php file has to perform two tasks, one is to call other
template files when needed and another is to include Wordpress loop to get
information from database. For basic structure we use header.php and footer.php
files. These files are included in Template Tag. Template tag is basically kind
of guide to Wordpress, which tells Wordpress to do particular task or to get
something.
-It is possible that template file itself contains other template files
to generate dynamic web pages in Wordpress. In Wordpress templates files
attached together and create template hierarchy. When user asks for particular
file Wordpress uses query string to search the related template file.
-Modification or customization of template is easy if you have knowledge
of HTML code. You can modify the header.php or footer.php of your site if you
wish to make change in their appearance.
-To create template page just write HTML code in any editor. You need to
add title, keywords, description everything for your HTML page. Now we can
create new Wordpress template page just have to go in control panel of hosting
account. There you have to just copy paste the HTML code in following manner.
<?php /* template Name: New Template Name
*/?>
<html> you HTMLCode.
Save the page with .php extension. Upload it
now to the hosting account to add it into the theme. This is how you can create
template. You can include template file in different ways like using include()
function or template_load() or using locate_template() or get_query_template()
functions. Each of these function used to include template file with quite
different manner.
Let’s see what we can do with template files
to make it more useful and functional using some tricks.
-Give name to template files
-Naming convention for style sheet to track start and end of particular
divisions.
-Note all template files and create list of all so that later on if you
want to make any modification to particular template file you can make it
easily.
-Search and sort all the categories and subcategories. Wordpress has
categories.php file.
-Use href to locate the images of your Wordpress site.
So, it leads me to end of discussion about how
to create template. I tried to explain the basic needs and structure of
template files and tried to give you some tips which you can use to enhance the
performance of your site.
Web Client base: UK (London, Essex, Devon,
Birmingham, Leeds, Glasgow, Somerset, Sheffield, Bradford, Edinburgh,
Liverpool, Manchester), USA (Florida, New York, California, Texas, New Jersey,
San Francisco, San Diego, Los Angeles), Australia (Sydney, Melbourne, Perth),
Canada, Sweden.