I recently wrapped up the development of a new theme for Cash Money Life based on the Thesis theme. One of the requirements was to have a primary menu at the top, and a secondary menu below the title. The primary menu would contain page links, while the secondary menu would contain categories, page links, etc. Here’s screen shot of what we ended up implementing:

This was the first time I had tried to add another menu with Thesis. The trend of having two menus is becoming pretty prevalent in the blogging world, so I thought I would share a little “inside info” info on how to add another menu using the Thesis theme. The menu I’ll add is a simple menu with very basic styling. Of course depending on your knowledge of CSS, the possibilities are endless on how the menu could look.
Adding the menu
To add the new menu, we’ll add a new custom function and hook; The code looks as follows:
/* Add the top navigation menu */
/* Links for top menu will need to be manually added here, since this menu isn't supported by Thesis */
function topnav_menu() {
?>
<ul id="topnav">
<li><a href="http://www.cashmoneylife.com">Home</a></li>
<li><a href="http://www.cashmoneylife.com/about">About</a></li>
<li><a href="http://www.cashmoneylife.com/archives">Archives</a></li>
<li><a href="http://www.cashmoneylife.com/about">Contact</a></li>
</ul>
<?php
}
add_action('thesis_hook_before_header', 'topnav_menu');
This code should be copied and pasted into your custom_functions.php file. There are multiple ways to edit your custom_functions.php file. I prefer to just ftp to my server using the FireFTP Firefox Addon and edit the file using a text editor (I use Notepad++). You can just add the code at the bottom of the file and save it.
You’ll now have a “menu” displayed at the top of your blog, but it will be pretty ugly, since we haven’t styled it.
Styling your menu
Now that we have the code and hook functioning correctly, let’s make it look nice. As I mentioned earlier, I’m just going to use a very simple style. Gray background, black text, and left justified (the menu on Cash Money Life is right justified).
Here’s the CSS: I won't go into the gory details on how the CSS styling actually works, but suffice it to say it styles our "topnav" menu with a gray background (#E4E4E4), makes the menu go across the whole width of the screen (width: 100%), and makes the link colors black (#000000). The above CSS code should be copied and pasted into your custom.css file. Where you paste it doesn't really matter, although I prefer to organize my CSS files in same order as the HTML. So this would go at the top. Save the file and reload your website and you show now have a nicely formatted menu at the top of your blog! How you use this menu is really up to you, but a common use is to use the top menu for page links such as "Home", "About", "Contact", etc. The secondary menu, or Thesis default menu, is then used to link to category pages.
.custom ul#topnav {
border-style: none;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
background:#E4E4E4 none repeat scroll 0 0;
width: 100%;
float: left;
}
.custom ul#topnav li { float: right; padding: 3px 10px 3px 0px; }
.custom ul#topnav li a { font-size: 1.1em; color: #000000; }
.custom ul#topnav li a:hover { text-decoration: underline; }







{ 13 trackbacks }
{ 24 comments… read them below or add one }
Love the job you did on my site, Larry! But now everyone is going to have the same upper nav bar!
Larry-
Thanks for the info. I attempted this on my own a bit ago and had no luck, so this is great. And don’t listen to Patrick, I don’t see anybody else using your tips *cough* http://www.jeffrosefinancial.com. Ehh-hem, I mean thanks again!
Hi Larry,
Using Thesis myself and came across your site via the Thesis Support Forum.
Your post on adding a top nav menu was very helpful and I thank you for you for posting it.
Regards,
Ray
Hey,
It did not work for me. You can check my site in the title. Just doesn’t work.
Althaf, I don’t see any of the code in my article on your site.
I removed it to be honest. I did exactly as you asked. Twice. Pasted it on top and bottom. Yet, nothing. Any advice?
You should write all the codes in HTML entities
Hi fanari. Not sure I understand what you mean.
Hey Larry,
Thanks for the tutorial. I tweaked your process a little, I added the 2nd menu to below the header. I just changed the hook. My problem is in styling the menu. I am trying to get it to look like the default menu with thesis. I tried copying the nav menu styles from the style.css and changing the #tabs to #topnav. That got it lined up right, but I can not get the links to be in their own little box and spaced correctly. ANy help would be great.
Benjamin, there’s a trick. There is also some styling in layout.css. This is the file Thesis uses when you change the font settings in the Thesis Design screen. You’re missing two additional styles for the anchor:
ul#topnav li a { color:#111111; display:block; letter-spacing:2px; line-height:1em; text-transform:uppercase; font-size:1.1em; padding:0.545em 0.818em; }The one’s your missing are the last two for font-size and padding.
That did the trick. Thanks so much for your help. I really appreciate it.
rockin’ dude. thanks for the tip!
Hi Larry
I added the code but it’s displaying below of the thesis menu
Any idea?
thanks
Thanks for the info! I’ve created a custom nav in the header and it’s almost perfect. I have tweaked the main nav to change background/font colors when the page is active; any way to get similar behavior in the custom nav bar?
Thanks for the tutorial. Works perfectly. I want to have the date in the same navbar to the left. How could I accomplish having your navbar code to the right navbar and a date in the left side of your navbar?
Thanks vb. Just float the date “left”, and float the other li items “right”. That should do it.
I added the code but it’s displaying below the menu any one out here has any solution for the same
Many of you may have already heard, but the favored replacement for Chairman is David Buskill. ,
It is nice one indeed, let’s try it now and see how it works with my new blog. Thanks
Thanks, great simple easy code to start with and customize for your own site. Much appreciated!
Can this display the links with drop down menu. I guess not. Can you give the code how to display sub pages with drop down menus.
Your tips are spot on. I made a small change to allow for adding new links using the Link Manager from Wordpress.
/* Add the top navigation menu */
/* Links for top menu will need to be manually added here, since this menu isn't supported by Thesis */
function topnav_menu() {
?>
<?php wp_list_bookmarks( 'title_li=&categorize=0&category=3&before=&after=&show_description=0&orderby=url' ); ?>
<?php
}
Sorry, formatting problems with first post…
Your tips are spot on. I made a small change to allow for adding new links using the Link Manager from Wordpress.
/* Add the top navigation menu */
/* Links for top menu will need to be manually added here, since this menu isn’t supported by Thesis */
function topnav_menu() {
?>
<?php wp_list_bookmarks( 'title_li=&categorize=0&category=3&before=&after=&show_description=0&orderby=url’ ); ?>
<?php
}
This is just what I was looking for, but I was also wondering if it was possible to create drop down menus for the category bar? It seems that even if my categories have parents, they all show in the bar. Thanks!