In the previous installment of Decrypting Thesis CSS, I talked about how to customize your banner using CSS. In this installment, I’m going to let you in on the secret of customizing your navigation bar (the shiny thing where all your links hang out). Dave Doolin of Website in a Weekend has an excellent tutorial on customizing the CSS for any WordPress navigation (and helpful graphics to boot!). He’s using Thesis 1.5 on his end but the theory is the same, any way you slice it. I’d recommend giving that a once over before checking out my tips and tricks.
Checklist o’ Essentials
Before beginning:
- Open custom.css and custom-functions.php in your favourite text editor or HTML IDE (ie., Dreamweaver).
- Open your FTP client.
- Have a back-up copy of your custom.css and custom-functions.php saved on your hard drive. Y’know, in case you make a boo-boo. Hey, it happens.
- And read Dave’s tutorial. It’s a great leap-off for what we’re working on.
Customize the Navigation Colours
The default of anything is boring, let alone the default navigation settings for Thesis. It’s so… pedestrian! Let’s jazz it up.
/* Custom Nav */
.custom .menu { background:#a5d643; border-style:none; border-bottom:none; }
In the first installment of this series, we talked about the .custom selector. Poke poke, Thesis. We’re working in custom territory here. By setting the background colour of the .menu, you’ve coloured the container… but not the links.
Save and upload this change.
See how the tabs are still gray and boring? I’ve got the remedy.
.custom .menu .tab-1 a { background:#a5d643; color:#ffffff; text-transform:lowercase; border:none; letter-spacing:-0.02em; }
.custom .menu .tab-1 a:hover { background:#5f3c76; color:#ffffff; text-transform:lowercase; border:none; letter-spacing:-0.02em; }
For, like, half a minute, I was tempted to show you the wall of code that was violetminded’s menu. Figured that was cruel, like real green dresses or some such nonsense. Onto decoding that madness.
We’re drilling down a little further in our selector hierarchy by taking a look at .tab-1, which is the first link in the navigation. There are two different lines of code doing similarly different tasks. The first line deals with the anchor (just the link by itself). It changes the background colour and the font colour, transforms the text to lower-case, removes the nasty border, and decreases the letter-spacing.
The letter spacing is non-essential. It’s just good typography practice for the typeface I chose for violetminded.
The second line of code deals with the hover state of the anchor. You move your mouse over that link and it dances the funky chicken. Don’t want the funky chicken? Change the colours around for the background and font. It’ll disco… or something.
You’re likely to have many other links in your navigation. Rinse and repeat as needed.
Caveat: The .tab naming system falls apart when it comes to custom links, subscribe, and home.
.custom .menu li a { background:#a5d643; color:#ffffff; text-transform:lowercase; border:none; letter-spacing:-0.02em; }
.custom .menu li a:hover { background:#5f3c76; color:#ffffff; text-transform:lowercase; border:none; letter-spacing:-0.02em; text-decoration:none; }
By specifying that you’re altering a list-item (the li selector), you’ve got your bases covered. The only thing that’s different from the code above is that, for whatever reason, there’s a default setting that sets the text-decoration to underline. You can allow that, if that’s what you want, but be sure to set the text-decoration to underline on all the other tabs. Why, you ask? Consistency, answers I.
No mo’ gray! And that, my loves, is a beautiful thing.
Moving the Navigation Bar Below the Banner
Having the navigation above the banner isn’t for everyone. Sometimes, you get the urge to be bold and wild by moving the navigation underneath! Navigate yourself to the custom-functions.php.
As much as I respect WP Designer and his desire to teach through making you type out code snippets (hey, it got me started on custom WordPress themes), I’m a code monkey. Through and through. And what did I learn in university and beyond? If you can copy & paste the code, it means that you’ve eliminated the possibility of typing error.
So, do yourself a favour, and copy & paste his snippet into your custom-functions.php.
//Move nav below header
remove_action('thesis_hook_before_header', 'thesis_nav_menu');
add_action('thesis_hook_after_header', 'thesis_nav_menu');
Wild, isn’t it?
These are hooks. Hooks are friends. It’s how we get around in Thesis. I know what you might be thinking and I thought it too: “DAMN THAT LOOKS COMPLICATED.” I told Dave the same thing. Then he helped. Dave’s a Thesis wunderkind. He told me that once you get the basics under your belt, it’s actually pretty easy. Seriously. And it was. But I digress. Let’s break down what that code does.
Assuming you’ve ran off to read those websites, you’ll understand what the “remove_action” and “add_action” are there for. Essentially, by removing the “thesis_nav_menu” from before the header and adding it to after the header, you’re moving its position. In code.
That was all you. And some sexy code.
Next up: More Navigation CSS Tips ‘n Tricks.
Check your inboxes and Readers for the next installment in the series: Decrypting Thesis CSS: Advanced Navigation Techniques. Need more? Follow me on Twitter!




{ 5 comments… read them below or add one }
Cool site. Maybe you should try to monetize it with
http://tiny.cc/05mrc
They do have 40 days cookie duration and they pay 10-15% commisions. They’ll match ads based on search query of your visitors and display relevant ads on you blog.
Wow this is a great resource.. I’m enjoying it.. good article
Thanks for this, I just started using Thesis CSS.
Although I’m not a Thesis user but I think I can convert this idea to regular theme. Thanks Amanda.
Arafat Hossain Piyada’s latest blog update: BingoBlack – 3 column professional Wordpress theme
Very cool and love your command of the language! Quick question: How difficult would it be to customize the nav elements with a unique graphic, maybe small vector icons or some such thing?
{ 13 trackbacks }