Thesis is what you make it
Lately I have been witnessing more and more complex and beautiful designs throughout the community. Thesis is really what you make it. I’ve found I can work away at a design mock up in Photoshop, and no matter what I come up with, I can replicate it in Thesis. Of course, as designs get more complex so does the development. Thesis can’t do everything right out of the box.
How to stick your Thesis footer to the bottom of the page
On it’s own, with no custom tweaks, the Thesis footer looks and feels great. It’s exactly where one would expect it to be in terms of placement. However, while designs get more complex and more elements are thrown into the mix things tend to not sit as well. Below is a shot of the standard out of the box design of Thesis. I’ve deliberately included a small amount of content and a tiny set of widgets for the example.
As you can see everything looks and feels great. But what if we wanted to mix things up and add a light grey background to the footer? Well let’s try exactly that and see what happens:
Now the placement of that footer isn’t working so well. We would expect the footer to be shot to the bottom of the page no matter the content and window size, or at least have anything below the footer the same colour. Of course, if we had more content we would get the desired effect- however that’s not always the case. So what now? Alas, Thesis can’t be at two places at once, so we are going to have to leave the defaults, and tweak our custom files.
The CSS
I’ve based the CSS off one of the most widely used sticky footer solutions in web design, The CSS Sticky Footer by Ryan Fait. Taking his original CSS we are going to work it into our thesis site. First, open up the custom.css file located in the custom folder (found in the Thesis theme directory). If it’s named custom-sample, simply rename it to custom and proceed. Make sure you back up anything in that folder before continuing.
Once you have custom.css open, pop this code into the file:
html, .custom {
height: 100%;
}
.custom .wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -100px; /* the bottom margin is the negative value of the footer's height */
}
.custom #footer_area, .custom .push {
height: 100px; /* .push must be the same height as .footer */
}Thankfully, that small bit of code is all you need in terms of CSS. Obviously you can change the height of the footer to your preference. Make sure if you change the height, to also change the .custom .wrapper margin as well (as shown in the comments). Right now you won’t get anything if you tried to refresh your Thesis page- as we haven’t created the wrapper or push containers that are referenced in the CSS.
The PHP
In that same custom folder you should find a separate file called custom_functions.php. Open that up and paste the code below:
add_action('thesis_hook_after_content_area', 'div_push');
add_action('thesis_hook_before_html', 'div_wrapper_start');
add_action('thesis_hook_after_content_area', 'div_wrapper_close');
function div_push() {
?>
<div class="push"></div>
<?php
}
function div_wrapper_start() {
?>
<div class="wrapper">
<?php
}
function div_wrapper_close() {
?>
</div>
<?php
}Basically this code is creating some new layout containers for the site. The header and content area will now be wrapped in a wrapper container, with a push container placed inside. Our CSS now has it’s elements to call on and have something to “push” to the bottom of the page.
We’re Done!
Yep, that’s it. If you have a very content lacking site you now have no need to worry. If you refresh your site, you should have something that looks like this no matter the window size:
The only thing you may want to change, like I said before, is the height. Other then that, you’re good to launch your site and see your changes. This technique should work in all major browsers and even IE6. If you have any questions, fire them in the comments section below.











{ 26 comments… read them below or add one }
Matt,
This is an excellent WP Thesis Tutorial! I’m excited to customize the footer of my site using this tutorial! Thanks a lot!
@RBeale
@Ryan
Thanks Ryan.. Glad it helped.. I’m hoping to write regularly on Thesis- but it’s tough to come up with original tutorials.
Thanks! It would be nice to see an option for this in the Thesis control panel on a future version. Keep up the good work!
Thanks for the great tutorial. I put three lines of text on a full width page to test this tutorial out. My footer doesn’t show at the bottom of the monitor. I have to scroll to see the footer. How can I make the bottom of the footer stay on the monitor at all times when there is only a couple of lines of text on a page?
@Bernardo
Thanks for the comment. We’ll keep it in mind for future skins.
@Bill
So that the footer is actually overlaying the content and floating at the bottom of the window- like this site? That would be a totally different approach. Check back and I’ll try to do a tutorial on that later.
@Matt: I have a another question… Why are there two different functions pointing to the same hook (thesis_hook_after_content_area)? Doesn’t one action override the other? Thanks again!
@Bernardo
They just get placed in order (one after the other rather then overwritten). They could be combined into one function but I find it more organized this way- but no technical difference.
hi matt,
When I create pages like: about, contact, privacy, sitemap they show up in sidebar. I am using 2 column thesis theme.
I want to put them either in nav bar on top OR at footer.
The way it looks now, they are in sidebar and nav bar.
How to solve this. Thanks.
@stan
You must have a widget enabled for pages in the sidebar. You can get rid of it through your dashboard, appearance> widgets.
To have them show up in the nav bar at the top you have to go into (in the WP dashboard) Thesis Options > Navigation Menu > Select pages to include in nav menu: … where you will select what you want to show up in the nav.
Hope that helps- If you have any more questions, submit them in the Thesisthemes support forum.
Nice tut, easy to follow.
Thanks Mat.
Hey Matt,
I’m having a hard time putting the footer. I was wondering how I could do it similar to yours but featuring our most recent blog posts instead.
Problem is, my custom.css file is not working!
Matt, sweet technique! I am avid Thesis developer as well and would like to apply the same technique to my sidebar to achieve 100% height, but no matter it doesn’t happen. Have any CSS and functions to apply to the sidebar to expand 100% height?
Thanks Matt.
All the best,
Jayson
http://wpcoop.org
http://groundupmedia.com
@Jayson
Usually I just set the background of the #content_box to an image, to simulate 100% height. That’s worked for me, and I think things would get over complicated trying to get 100% height otherwise.
Hey Matt,
This is awesome! As you said it, Thesis is what you make of it. I do not and cannot afford to get a Thesis theme, However I managed to custom design one myself. Can you help as to how I can add the same to my theme.
Cheers,
Eddie Gear
@Eddie,
This is a Thesis tutorial, so it’ll be quite different for another wordpress theme (especially one I have no knowledge of). Try this link and see if it can help: http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
I just tried implementing this tip using Thesis 1.6b2, but it’s not working. If I place the “push” div inside the “thesis_hook_after_content_area” hook, Thesis seems to skip it (almost as if the hook is ignored). Placing said div on any other hook seems to work.
Has someone made this work in Thesis 1.6 yet? TIA
Once 1.6 is officially released I’ll update the tutorial.
Great Tutorial Matt,
I seem to have an issue in Internet explorer though.. there is a large white space appearing under the footer.. any ideas?
Joe
Thanks Matt,
Explained exactly what I wanted, clearly and concise,
Matt please update it for Thesis 1.6
Asim,
Everything should be working with 1.6 just fine. I’ve just tested and didn’t have to make any changes. Let me know what’s not working for you.
Greetings Matt. I like the way you customized your footer with black and links going down. Will that be okay if you can let me know how you did it. Many thanks in advance.
Tanya
Tanya,
There’s a great tutorial here: http://www.kristarella.com/2008/11/thesis-footers-101/
Thanks Matt
I have seen Kris’s footer tutorial before and she is one excellent tutor. I tried following her instructions and yet still am facing a few problems.
If it is okay with you, could you email me how you coded your custom.css and the custom functions and how the links were created.
Thanks again
Tanya
P/S Sorry to sound silly, but I have been looking for something like how you did yours!
Tanya,
We can’t supply you the code for our site, as its part of our original Thesis site, and we wouldn’t appreciate someone just copying our code/style.
It would take quite a bit of time to detail how we did the custom footer, and we have tons of original code in the custom_functions file.
If you want something similar, you can hire us to do it:
http://thesisthemes.com/request-a-quote/
or try the DIYthemes forums for help:
http://diythemes.com/forums/index.php