Hey there. It’s my birthday tomorrow (November 10th), and I’ve been a bit lazy this week and not written much new content. – What’s been published in the last few days was written Monday or before and scheduled for auto-publication. That being the case; you might find that there aren’t that many, if any, new articles being published on this blog in the next few days as I catch up.
You may have noticed that in the Northern Hemisphere’s Summer I write the odd article now and again, but in general I work off-blog, as it were, doing other things. I do keep up the routine maintenance as much as I can at that time; but otherwise I’m usually outside and enjoying the limited amount of British good weather while embarking on some project or another. I try and schedule things so that when the temperature falls and the nights draw in, I’m blogging and coding away frantically at this here abortion that you’re looking at now.
…And, basically, that’s what I’ve been doing of late; hence the increased amount of new material being produced, accompanied by changes – hopefully improvements – in this blog’s design. The theme I’m using was once the TwentyTen theme. Having hacked and customised it beyond recognition, the only definite resemblance to the original is the name: It’s still called TwentyTen, but I think I might change that soon to TwentyTenPlus or something similar.
I do hope that you readers like the design changes incidentally. I’d appreciate some feedback on that if you’ve got a second to spare. I might even conduct a poll at some point in the near future… – Pipeline dreams: So much to be done and so little time to do it in. – Anyway, before I reapply nose to grindstone I was thinking about clueing you all in on a little WordPress hack that I’ve been utilising in the last week or so: -
When you’re blogging, or at least trying to blog, professionally; there are certain things within a theme that need to be altered to accommodate the air of professionalism that you’re attempting to demonstrate. The exact nature of this of course varies niche to niche, blog to blog, and from person to person. Personally I found that the standard footer I was using for every page and post didn’t appear suitable for use with every page and post, so I decided that something needed to give: I needed more than one blog footer, for use in the same blog. – The blog in question being this one.
Looking at the php code of all the templates; one of the last instructions in nearly all of them, bar the single footer template itself, and the header template, is:
<?php get_footer(); ?>
That piece of php calls the footer to the rest of the page when all the other content has been assembled on it by the server. The problem with that instruction is that there isn’t a choice, nor is there any room for choice, in alternative footers. The code being written in that way assumes that there is only one footer – coded in a singular certain way – in the whole of existence as far as that WordPress theme is concerned. – So to have more than one footer in use we need to change that instruction in the case of some of the templates. – But what do we change it to? Currently the coding is correct; there is no other footer in existence as far as the theme in question is concerned. – So our first task is to make at least one more footer.
The easiest way to create another footer is… Copy the original footer. – OK so we copy the original footer; now what? – We have 2 footers; clones of one another, both having the filename “footer.php”. The logical thing to do would be to change the name of the copy-file: Let’s change it to footer_1.php. – That gives it some individuality. We can now differentiate between the two. We can even copy footer_1.php into the WordPress theme as a new file!
- But all of the templates that call a footer still have <?php get_footer(); ?> in them as the last instruction; and they’re all still calling the original footer – footer.php – by that line. WordPress isn’t even recognising footer_1.php yet; so we need to get WordPress to do so before we can go any further.
If we open the new footer_1.php file we’ll see exactly the same content as in the original footer.php . Look at the php statement of the first few lines: -
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the id=main div and all content
* after. Calls sidebar-footer.php for bottom widgets.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
?>
That piece of php identifies the Template file to WordPress. If we remove it then WordPress will no longer think that the file is footer.php . If we replace it with something else that WordPress understands then WordPress will think that it’s a different file… –>->-><fast-forward>->->-> If we replace it with: -
<?php
/*
Template Name: footer_1
*/?>
- Then WordPress will recognise it as a theme file; footer_1.php . – Progress is being made
So now that WordPress accepts it as a separate theme file; another template, a unique template; we can now call it from any of the other existing templates that are calling footer.php with the instruction <?php get_footer(); ?> – But not with the instruction <?php get_footer(); ?> . – That will call the original footer still.
You can’t and don’t want to call 2 different footers from one single template so we need to remove the line <?php get_footer(); ?> . It would seem logical to replace it with <?php get_footer_1(); ?> , but that won’t work.
–>->-><fast-forward>->->-> Replace it with : -
<?php include(“footer_1.php”); ?>
… And now whichever template you changed that php in, by replacing the existing instruction, will call footer_1.php rather than footer.php .
- In fact you can create footer_2.php, and footer_3,4,5,6,7… in the same way, if you need that many footers.
However many new footer files you create, you can have unique content in each of them: You can have a different footer for every page and post template if you so desire.
WordPress is such an amazingly versatile platform, and anyone who knows how to do it can do just about anything with it.
Now you too can have as many different footers as you like, within reason of course, on your blog.
With some themes (Not with TwentyTen) you can employ the same type of tactics with regard to headers too… Oops; that’s another post’s worth. – Happy blogging.
You’re looking at Kkomp.com – Beyond. <--Link to Home page.
The URL of what you see is http://kkomp.com/2011/11/09/how-to-have-multiple-footers-on-your-wordpress-blog-happy-birthday-shazzalive/
Why not share the linked URL by pasting it into Facebook or sending it by email?
Post Footer automatically generated by wp-posturl plugin for wordpress.















