(Moderator's note: The original title was "How can I create a widget area in the navigation bar (Genesis specific)?"(

I'm trying to create a widget area in my navigation bar. I'm attempting to adapt this from Bill Erickson's excellent tutorial here on adding static content to the navigation bar.

This is the code I've added to my functions.php file to register and place the widget area:

    'name'=>'Nav Right',
    'description' => 'This is the right section of the navbar.',
    'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget'  => '</div>',
    'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'

//Adding the widget area to the navbar
function navbar_widget() {
    <div class="nav_right">
    <?php if (!dynamic_sidebar('Nav Right')) : ?>
            <div class="widget">
            <h4><?php _e("Nav Right", 'genesis'); ?></h4>
            <p><?php _e("This is a widgeted area which is called Nav Right.", 'genesis'); ?></p>
    <?php endif; ?>
    </div><!-- end .nav-right -->

However, what I end up with is this:

alt text

With the widget area outside of the navigation bar (and the links removed from the navigation bar - there should be a Home and About link there).

This is the html (when I view source of the page):

<body class="home blog logged-in content-sidebar"> 
 <div id="wrap"> 
<div id="header"><div class="wrap"><div id="title-area"><h1 id="title"><a href="http://travisnorthcutt.com/gateway/" title="Research Valley International Gateway">Research Valley International Gateway</a></h1><p id="description">Just another WordPress site</p></div><!-- end #title-area --><div class="widget-area"></div><!-- end .widget_area --></div><!-- end .wrap --></div><!--end #header--> 
   <div class="nav_right">
                <div class="widget">
            <h4>Nav Right</h4>
            <p>This is a widgeted area which is called Nav Right.</p>
        </div><!-- end .nav-right -->
  <div id="nav"><div class="wrap"></div></div>

Any suggestions on how to get the new widget area that is created to be within <div id="nav"></div>?

  • I feel this question is better asked on the StudioPress forums. This site should not devolve into a channel for free support for premium themes Oct 6, 2010 at 23:51
  • This question has also been asked on the SP forums ;-). I think it's a good question to ask here - it's technical in nature, and (I think) will have an objective solution. Trust me, I'm not trying to cause this site to 'devolve' into free support for premium themes. I have paid for a license for StudioPress themes and by no means am I trying to get "free" support somehow. Oct 7, 2010 at 1:48
  • Do these type of questions belong on this site? Join the discussion on Meta!
    – Jan Fabry
    Oct 7, 2010 at 7:42
  • @Ash G: Is it really a problem to have answers to 3rd party solutions here? I for one would love to have them here because otherwise we'll be at the mercy of much poorer support mechanisms offered by those 3rd parties. Said another, what does it hurt? Oct 7, 2010 at 10:24
  • As per our discussion on meta, I retract my complaint and throw myself behind the question. As soon as my vote is unlocked (have to wait, it's only been 12 hours) I will reverse it. Love the fact that we can ask, answer, debate and convince! Oct 7, 2010 at 12:26

1 Answer 1


You are adding filter, not an action. I don't know how Genesis hook works, but native wp_nav_menu_items passes (and expects back) markup of custom menu items.

Instead of echoing your additional stuff you should append it to input and return.

This is clearly how it's done in tutorial you linked to:

function follow_icons($output) {
    $follow = 'some stuff';
    return $output.$follow;

Upd. Forgot to add about sidebar part. Since sidebars are echoed by definition you will likely have to buffer its output to use in such fashion. Maybe instead of making widget ares literally inside menu it is better to look for hook that allows to do this nearby?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.