Once you start messing about with WordPress and looking to expand it to fit your websites requirements you will undoubtably want to use different headers, sidebars, footers and even comment templates.

Its actually really easy to do in WordPress and because you will be utilising files that should already exist in your template, it doesnt take long at all.

I guess most people will want to change the sidebar first, implementing new menus i.e. floating it left or right to create different page styles etc, so I will focus on sidebars but applying the principles will work for every template file mentioned above.

OK lets get started.

First create a new template file called called ‘sidebar2.php’ or similar and open ‘the original ‘sidebar.php’. Copy the code from sidebar.php and paste it into sidebar2.php. Now you have a new sidebar! Obviously you will want to make changes to the structure using CSS etc but I will leave that up to you.

Now that we have the new sidebar2.php file how to we get WordPress to display it? Just replace this line:

with this one:

You would use this line to include all your new files i.e.

or

However getting the new comment template to display is slightly different. You must replace this line:

with this one:

Well there you have it, you can now create as many different template files as you want and implement them on your WordPress site. Sweet!

0

Related Posts:

One Response to “Using multiple/different headers, sidebars, footers and comment templates in WordPress”

  1. September 6, 2011 at 3:19 pm

    Thanks for this. After half a morning trying to work out how to have two comments templates working at once, I stumbled on your page. Thanks for taking the time to post it – problem solved.

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 Effutio - All Rights Reserved

Perth Web Design - Free Web Host