Thesis Hook Example 3: Changing the Thesis Footer
A lot of times people want to customize their footer to add copyright notices or other information. The example below will show you how to change your Thesis footer link.
Step 1: Open your custom_functions.php file (thesis > custom > custom_functions.php) in your favorite editor
Step 2: Underneath the example code already in the file, place the following code:
/* Custom Footer Hook */
remove_action('thesis_hook_footer', 'thesis_attribution');
function add_custom_footer () {
?>
<p>© 2008 Ourblog.com – All rights reserved. – <a href="http://www.ourblog.com/privacy-policy/">Privacy Policy</a></p>
<p>No content on this site may be reused in any fashion without written permission from Ourblog.com or whatever you want your footer to include</p>
<?php
}
add_action('thesis_hook_footer', 'add_custom_footer');
Again, the /* Stuff Inside Here */ is a label for the code below so you know what it is at a single glance. This is not part of the actual “code”. The remove_action(‘thesis_hook_footer’, ‘thesis_attribution’); tell Thesis that you wish to remove the regular Thesis footer function (thesis_attribution which we know is the default function the hook uses) from the thesis_hook_footer (the hook we know generates the footer). The word “function” tells Thesis you want it to do something. The add_custom_footer is what I decided to name that function.
The HTML for what I want to appear in the footer is added and then the add_action(‘thesis_hook_footer’, ‘add_custom_footer’); line tells Thesis you want to add a function to the thesis_hook_footer (the hook that creates the footer) and the function you want to add is the one we created – add_custom_footer.
So, the code above essentially says “Hey Thesis, please remove the code (thesis_attribution) you put into the footer (thesis_hook_footer) by default and replace it with our code (add_custom_footer). You can do that with any hook function you’d like.
No comments:
Post a Comment