Skip to content

Instantly share code, notes, and snippets.

@Ramoonus
Forked from GaryJones/functions.php
Created February 11, 2012 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ramoonus/1799481 to your computer and use it in GitHub Desktop.
Save Ramoonus/1799481 to your computer and use it in GitHub Desktop.
Add widget area before primary menu items in Genesis.
<?php
/**
* Adds a widget area before primary menu items.
*
* @author Bill Erickson
* @author Gary Jones
* @link https://gist.github.com/gists/1799174
*
* @param string $menu Existing menu items markup.
* @param array $args Menu arguments.
*
* @return string Amended menu items markup.
*/
function sws_social_icons( $menu, array $args ) {
if ( 'primary' !== $args['theme_location'] )
return $menu;
ob_start();
dynamic_sidebar( 'social-menu' );
return ob_get_clean() . $menu;
}
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment