When Chris Pearson, the creator of Thesis, recently redesigned Pearsonified.com on Thesis, he did something amazingly cool: he put rotating images in his header area.
Well, I was so inspired by his design that I wanted to figure out how he did it. It turns out that putting rotating images in your header is extremely easy.
On the backside.
Well, let’s get started. From the WordPress Dashboard, go to Thesis Options -> Design Options -> Feature Box.
In this tutorial, I am setting the Feature Box to “Full Width Above Content And Sidebars.” It is completely up to you whether you chose to show the rotator on every page or just the home page.
The Code
Let’s start with the Custom.CSS. I just want to warn you right now: THIS IS SUPER EASY!
Copy and paste the following into your Custom.CSS:
.custom #feature_box { padding: 0; border: none; }
.custom #feature_box img { display: block; }
Wow! That’s it, folks. Ok, now let’s knock out the Custom_Functions.PHP part of this. Again, don’t be shocked when you see how unbelievably simple this is.
function header_rotator() {
echo thesis_image_rotator();
}
add_action('thesis_hook_feature_box','header_rotator');
Seriously, that is all. Unreal how simple that is, isn’t it?
Purchase or Upgrade to the Thesis Developer’s Option Today!
Add an Anchor Tag
Let’s say that you want to add an anchor tag, <a>, around the rotating image. Simply put this in your custom_functions.php file instead of what’s above:
function header_rotator() {
?><a href="http://addressgoeshere.com"><?php
echo thesis_image_rotator();
?></a><?php
}
add_action('thesis_hook_feature_box','header_rotator');
Just add the address you want to link to, and call it a day ![]()
What about the images?
To get the images to line up perfectly you need to know the width of your site. If you use the Firebug plugin for Firefox or Google Chrome, you’ll have no problem finding out the width. Just remember that if you have page padding (as in the <div class=”page”>), you need to exclude that from the width calculation.
Also, I recommend making the images the same height so that the layout doesn’t shift on refreshes.
Oh, yeah. Don’t forget to Upgrade to the Developer Option! You will never regret it!
{ 3 trackbacks }
{ 48 comments… read them below or add one }
Hi Matt
Thank you for showing me this link on Twitter the other day.
To everyone reading – Matt is right, this is one of the easiest and quickest mods you’ll ever do with Thesis.
Thanks again
@Richard
Thanks, man!
Thanks for the tutorial, easy to understand and turned out great!
Hey Matt,
Great tutorial, adds a lot to the site. I was wondering if you’re planning on writing another tutorial for a rotating feature gallery that’s linked to latest posts (like what you have on your homepage)?
Would it be possible to do this not in the header but below the navigation bar taking up the full width of the site. Then here is the kicker..
Lay a form on top of it
Similar to this site http://www.atproperties.com/
@Loren
That is quite a different thing. You’d need to have a CSS background image rotator. I’ll look into that, though.
Completely forgot about you replying to me. I did figure it out but the client didn’t like it.. I’ll have to pull the code out of the page I used and do a tutorial on it
This is cool.
But what if I want to do the rotating header image AND use the multimedia box to show a youtube video.
Can this work with both going on at once?
@Ronald
That’s no problem. Just make the changes in the multimedia box. Should have absolutely no effect on the rotator.
Very nice tutorial.
Hey Matt-
1. Is it possible to make these images clickable?
2. The name of the function is misspelled in this post, just FYI.
3. Is there a reason you don’t have the Reply button enabled in the comments? Just curious.
4. The “Subscribe to comments” plugin might be helpful when n00bs like me leave comments and want to check back when you’ve answered
@Willie
Thanks Willie!
Hey Matt,
I put the code in and it worked great the first time. I took it out for a few days because I was playing around with my header, but decided to put it in again – now it’s not working properly!
See the gray bar on the right side of the feature box? I resized my header and the feature box pictures from 979 to 969 px, but it seems as though the feature box wants to stay at 979…any idea how to fix this?
I just resized the sidebars and that took care of it….sorry for the false alarm and thanks again for putting these tutorials together, they’ve been incredibly helpful
@Dan
It looks fine to me. Not sure what you’re seeing. Interesting blog, btw
Does this work if you are already using the multimedia box for something else?
@Kopepasah
This uses the feature box, not the multimedia box.
This worked great!
I’m wondering how to move the nav menu below the rotating header.
Any advice?
Thanks,
Ben
hi, so i followed your instructions but still have padding and a gray color in the feature box. please let me no how to correct this. thanks
Not seeing that problem on your site, but the feature box does have padding by default.
Wow, I’ve been using Thesis tutorials for some time and yours is far and away the clearest and easiest to follow. Question: Is there a way to make the images auto-rotate rather than on a browser refresh? Thanks again!
I’m looking for the same solution, how to make the images auto-rotate so a browser refresh is not required. Is there a tutorial anyone can point to?
Thanks.
–Justin
I originally answered your question thinking you wanted to use the rotator pictures and PHP. You could use this instead: http://thesistutor.com/how-to-make-a-jquery-image-slideshow-in-thesis/
Great tutorial! How would I go about using the feature box to take up only half the header?
I want to have my logo image on the left and the feature box with rotating images on the right in the header. Is there a simple way to do this?
Hi Matt,
Wondering if something has changed? I have the latest version of Thesis and followed your tutorial step by step, but I’m ending up with a border on the header image – tried making it larger/smaller and resizing the columns – no luck getting rid of it.
Check out http://www.bamboogreenhomes.com and tell me where I’m going wrong Oh Thesis God.
Cheers,
Nicole
Hi Matt,
Excellent tut! A question, though.
I have Featured Content Gallery inside my Feature box and it works like a hot damn. However, it’s not centered – it’s flush left. The layout.css has symetrical padding (1.1em left and right) for the Feature Box which to me says, ‘centered’. Yes, I can mess with the left padding to make it ‘appear’ centered, but that doesn’t make any sense.
Thoughts? Ideas? Thanks.
Randy
Adjusting padding to center something is indeed centering.
Hello Matt,
I have the same question as Philly. Logo to the left, rotating images to the right. I already have the logo in place via custom css and custom functions.php, not sure what to do next. I’ve seen others using a banner idea…just being careful with a client’s site.
Thanks
Hey Matt,
Excellent tutorial, just what I needed!
A couple of things I think you should know though:
There is an error in the ‘Add an Anchor Tag’ script, line #4 should look like this:
?><?php
Also, since I had moved my navbar below the header area, it appeared inside the featurebox when I used your method. Instead, I turned the feature box off in the settings and added the feature box using the header hook , like this:
add_action('thesis_hook_header', 'thesis_feature_box');
Of course, this only works if you want the rotating header sitewide..
You´re welcome to check out http://lunde.x10hosting.com/pro to see how it turned out. Thanks again!
Thanks for the update to the code – I used the code to add in the rotating images and it worked fine. Then I tried to change to use the “add an anchor tag” and have the following error that I cannot seem to get rid of no matter what I do in the customer file editor: Fatal error: Cannot redeclare header_rotator() (previously declared in /home/***/public_html/wp-content/themes/thesis_17/custom/custom_functions.php:39) in /***/public_html/wp-content/themes/thesis_17/custom/custom_functions.php on line 47
How can I fix this?!
Thanks for the great tutorial!
Hmm, it seems the “close a” tag was stripped from within the “code” statement in my comment..
What I meant to say though, is that
<?phpis missing after you close the a-tag on line 4, which produces a fatal error if you just copy and paste the code like I did....Again, thanks for the help!
Nice spot on that. Thanks!
Also, if you need to add the feature box in the manner you described, and only want it on the homepage, you would do the following:
function header_rotator() {
if (is_home || is_front_page()) {
//the code from the tutorial goes here
}}
The important part is that you remember two curly brackets at the end.
Hi Matt,
I have a quick couple of questions but they are also an urgent as I am trying to get my site up live this weekend if possible… I have the full with feature images working with no issue which is due to your clear instruction. I would really like to have then auto rotate rather then just on a refresh.. can you tell me how to do this ( hopefully this is simple ). and then two how can i make each image clickable to an individual url… just like you do on the front of your site which looks great.
P.S. The first question is really my most urgent, i am not a programmer and I cannot work this out, thanks in advance Matt
You can hire me to help you, or use this tutorial to achieve what you want.
hi!
i’m a total newbie – and probably an idiot too ;o( I am trying thesis in my test.coconutrobot site – and here is my dumb question…ready?
Where do I store the images for the rotating image header? I put the PHP in the Hook Plugin – is that okay?
thanks!
Hi Matt,
Thanks for the tutorial.. Really great!
I have some questions, Is it possible to have rotating headers on the home page and have different header assigned to each other page? Can you teach me how to do that?
Thanks!
Hi,
Great to see you are pisces (the birthday post) ! Thanks for the tutorial, it really helped me!. Could you tell me how can I remove padding on my left of feature box? Tried to get ti out for looooong time . could not get it done
Hi,
Spent ages trying to find out how to do this and eventually found your site.
Thanks for that, I also added alt and title tags to the images for SEO
Many THANKS. If you were here, I’d buy you a Sam Adams Octoberfest!
Hi Matt,
Great tutorial!
I seem to have missed something though as I have a white space at the left and I have spent all afternoon trying to get rid of it and it won’t go away. can you help please?
Laura
forgot to add the web address: http://weddingsphotographerkent.com/
that is your page padding, adjustable from within the thesis design options->site layout->outer page padding. set yours to zero.
Hi Matt,
Thanks for getting back to me.
The problem I have is that I want the padding on the text, just not on the header.
What if you want a specific header image called out for certain pages? Can you use the Thesis custom fields to display a certain image?
Hi, I used this tutorial, and it works great, How do i then move the created feature box into the header space?i want to have a logo image to the left and then my sized feature box to the floated to the right of it. i have the horizontal alignment working but i can figure out how to move the feature box out of its default hook into the header area. any help would be greatly appreciated.
Thanks. Nice trick. I’d like to apply it soon. You made it quit easy.
Hey Matt! Great tutorials. I was wondering the same thing as Ali and Philly. Is there a way to position the featurebox within the header, next to a static logo?? Would love your feedback on this!
HOW CAN I PUT THE MENU ABOVE THE GALLERY WITH THE LOGO STAY IN TOP.