• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Adding widget content on the end of the secondary navigation menu

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding widget content on the end of the secondary navigation menu

This topic is: not resolved

Tagged: extra nav, secondary, widget

  • This topic has 4 replies, 2 voices, and was last updated 6 years, 5 months ago by glenkg.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • December 15, 2016 at 10:10 am #197632
    glenkg
    Participant

    Hi ,

    I found the code to add a search box of or date next to the secondary navigation menu. But is it also possible to hook a widget area to this position?

    From what i found so far add something like this?

    
    add_filter( ‘wp_nav_menu_items’, ‘right_scf’, 10, 2 );
    
    function right_scf’($menu, $args) {
    $args = (array)$args;
    if ( ‘secondary’ !== $args[‘theme_location’] )
    return $menu;
    ob_start();
    dynamic_sidebar('Secondary Right');
    $search= ob_get_clean();
    return $search . $menu;
    }
    

    Is this way off or am I close? Or does someone have another option in their experience that worked better? Thank you.

    December 15, 2016 at 11:44 am #197643
    Victor Font
    Moderator

    That would work if it were coded correctly. If you use it as displayed, it will crash your site. You should be using straight quotes instead of curly quotes and there shouldn't be a quote in the function name declaration.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    December 19, 2016 at 5:26 am #197810
    glenkg
    Participant

    Hi Victor,

    Thank you for pointing that out. I changed it

    
    add_filter( 'wp_nav_menu_items', 'right_scf', 10, 2 );
    
    function right_scf ($menu, $args) {
    $args = (array)$args;
    if ( 'secondary' !== $args['theme_location'] )
    return $menu;
    ob_start();
    dynamic_sidebar('Secondary Right');
    $search= ob_get_clean();
    return $search . $menu;
    }

    Nothing is happening.. do I still have to add the sidebar?

    December 19, 2016 at 5:52 am #197812
    glenkg
    Participant

    Hi Disregard the lost question, It was that.

    But now it comes above the secondary menu. Is there a way I can get it to appear after the lost menu-item from the secondary menu? Should I make it a menu item of sort? It would be nice if it would be added like that. Is this possible?

    thank you

    December 19, 2016 at 6:31 am #197816
    glenkg
    Participant

    I added the line:

    $menu .= '<li class="right search">' . $search . '</li>';

    and then it shows up twice. One time correctly.

    
    function right_scf ($menu, $args) {
    $args = (array)$args;
    if ( 'secondary' !== $args['theme_location'] )
    return $menu;
    ob_start();
    dynamic_sidebar('Secondary Right');
    $search= ob_get_clean();
    $menu  .= '<li class="right search">' . $search . '</li>';
    return $search . $menu;
    }

    this is how it shows up. the one above the menu has to be disabled:

    http://imgbox.com/kHVuDavR

    Do I have to combine the sidebar with the li class? I am close now, but still this lost hurdle..

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble