Community Forums › Forums › Archived Forums › Design Tips and Tricks › move search form to secondary nav
Tagged: relocate search to subnav
- This topic has 1 reply, 1 voice, and was last updated 11 years, 1 month ago by marjwyatt.
-
AuthorPosts
-
March 17, 2013 at 4:31 pm #28687marjwyattMember
I'm a bit frustrated and finding it hard to believe that no one has tried to do this before and published a solution but, after multiple searches, the only evidence that I could find of this came from the old forum.
http://www.studiopress.com/support/showthread.php?t=80573&highlight=move+search+subnav
I implement this code to no avail. I then installed this plugin:
http://designsbynickthegeek.com/plugins/genesis-nav-menu-amplifiedActivating the plugin (after following the installation instructions), resulted in the list style for the subnav not being "inline" and it also hosed up styling for the primary navigation.
My resistance to using a plugin to solve what ought to be a simple issue like this is legendary. Can anyone tell me the proper filter and/or hook to use to move the navigation right search to the subnav menu which has been placed above the header successfully already?
Theme Eleven40 v1.1
Genesis v 1.9.1
WordPress v3.5.1
I am unable to provide a link to the development because it is on my Xampp localhost.
Virtually Marj Wyatt
VirtuallyMarj.com | Twitter | Facebook | Google +March 17, 2013 at 10:26 pm #28740marjwyattMemberIf anyone else needs to do this, here is the solution that worked for me. The inspiration was derived from this old blog post written by Bill Erickson: http://www.billerickson.net/genesis-wordpress-nav-menu-content/
This code is added to your child theme's functions.php:
/** Add search form to secondary navigation menu */
// Ref link: http://www.billerickson.net/genesis-wordpress-nav-menu-content/
add_filter( 'genesis_nav_items', 'dt_subnav_search', 10, 2 );
add_filter( 'wp_nav_menu_items', 'dt_subnav_search', 10, 2 );
/**
* @param string $menu
* @param array $args
* @return string
*/
function dt_subnav_search ($menu, $args) {
$args = (array)$args;
if ( 'secondary' !== $args['theme_location'] )
return $menu;
$dtsearch = '' . genesis_search_form() . '';
return $menu . $dtsearch;
}Additionally, I copied the Primary Navigation Extras styles to create styles for Secondary Navigation Extras:
/* Secondary Navigation Extras
------------------------------------------------------------ */#subnav .menu li.right { float: right; font-family: 'Oswald', arial, serif; padding: 10px 15px; }
#subnav .menu li.right a { background: none; border: none; color: #333; display: inline; text-decoration: none; }
#subnav .menu li.right a:hover { color: #ed702b; text-decoration: none; }
#subnav .menu li.search { width: 28%; padding: 7px 10px 0; }
#subnav .menu li.rss a { background: url(images/rss.png) no-repeat center left; margin: 0 0 0 10px; padding: 0 0 0 16px; }
#subnav .menu li.twitter a { background: url(images/twitter-nav.png) no-repeat center left; padding: 0 0 0 20px; }Tiny CSS tweaks after that to make it work on my site design and I'm all set. I hope this helps someone else.
Virtually Marj Wyatt
VirtuallyMarj.com | Twitter | Facebook | Google + -
AuthorPosts
- The topic ‘move search form to secondary nav’ is closed to new replies.