This post has been marked as old. The code might no longer work. Comments have been disabled as this is no longer maintained. Use the search on the right to find a newer tutorial.

Full Width Navigation in Thesis

intoronto

When building full-width Thesis websites, you’ll often want to apply a different background to the navigation and header area.

Using the hooks thesis_hook_before_header and thesis_hook_after_header won’t work, since they’ll put the navigation outside of #header but still inside #header_area (the full-width wrapper for #header). Here’s how you can stick it before or after the #header_area, in its own full-width wrapper.

Navigation before the header

We’ll remove the default navigation, add our new navigation function to the hook thesis_hook_before_html, then actually define the function.

remove_action('thesis_hook_before_header','thesis_nav_menu');
add_action('thesis_hook_before_html','custom_nav');

function custom_nav() { ?>
<div id="nav_area" class="full_width">	 <div class="page">	 <?php thesis_nav_menu();?>	 </div>	</div>
<?php }

Navigation after the header

We’re going to do the same as above, but use the hook thesis_hook_before_content_area instead of thesis_hook_before_html.

remove_action('thesis_hook_before_header','thesis_nav_menu');
add_action('thesis_hook_before_content_area','custom_nav');

function custom_nav() { ?>
<div id="nav_area" class="full_width">		<div class="page">			<?php thesis_nav_menu();?>		</div>	</div>
<?php }

Bill Erickson is a WordPress Consultant who builds custom websites using WordPress as a CMS and the Genesis framework. He contributes to the WordPress community through free themes, plugins, tutorials, and core patches. He's also a cofounder of the BIL Conference (the open analog to the TED Conference).

Looking for more great tutorials? See them all!

Comments

  1. littlelostrobot says:

    I love this Thesis layout, but had no idea how to implement it (i'm still trying to wrap my mind around the hooks).
    Thanks for the tips.

  2. Paulo says:

    Bill,
    This code can be used by the plugin Thesis OpenHook?
    Well tried it with him and did not work …
    thanks

    • Bill Erickson says:

      Yes, it should work, but I would highly recommend not using OpenHook. If you make any mistakes with your code your site will be inaccessible and you can’t get back in to fix it. You’ll need to use an HTML editor to log in and correct the error, so you might as well just start with an HTML editor.

  3. Pink Ronnie says:

    Awesome, thanks for this Bill! This was exactly what I needed….

  4. Wendy says:

    Thank you for this short tutorial. I thought this should have been so easy and I’ve been looking to create the navigation before the header, not after.

    Thanks again!

  5. Hyder says:

    thanks for this article, this what i was looking for :-)

  6. This is the most clear explanation I have seen so far on modifying the header nav. Hooks seemed so frightening, but I am starting to get comfortable with them. Ready to ween myself away from the packed Thesis themes and start doing my own coding. Thanks for the informative post.

Trackbacks

  1. [...] Thesis Tip #18: Full Width Navigation Thesis Tip #17: Adding Content Between Posts Thesis Tip #16: Redirect Pages [...]