Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Forked from billerickson/widget nav.php
Created February 11, 2012 12:20
Show Gist options
  • Select an option

  • Save GaryJones/1799174 to your computer and use it in GitHub Desktop.

Select an option

Save GaryJones/1799174 to your computer and use it in GitHub Desktop.

Revisions

  1. GaryJones renamed this gist Feb 11, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. GaryJones revised this gist Feb 11, 2012. 1 changed file with 18 additions and 8 deletions.
    26 changes: 18 additions & 8 deletions widget nav.php
    Original file line number Diff line number Diff line change
    @@ -2,15 +2,25 @@

    add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
    add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );

    function sws_social_icons($menu, $args) {
    $args = (array)$args;
    /**
    * 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');
    $social = ob_get_clean();
    return $social . $menu;
    }
    dynamic_sidebar( 'social-menu' );
    return ob_get_clean() . $menu;

    ?>
    }
  3. @billerickson billerickson renamed this gist Feb 11, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion widget nav → widget nav.php
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,9 @@ function sws_social_icons($menu, $args) {
    $args = (array)$args;
    if ( 'primary' !== $args['theme_location'] )
    return $menu;
    $social = dynamic_sidebar('Social Menu');
    ob_start();
    dynamic_sidebar('Social Menu');
    $social = ob_get_clean();
    return $social . $menu;
    }

  4. @invalid-email-address Anonymous created this gist Feb 10, 2012.
    14 changes: 14 additions & 0 deletions widget nav
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php

    add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
    add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );

    function sws_social_icons($menu, $args) {
    $args = (array)$args;
    if ( 'primary' !== $args['theme_location'] )
    return $menu;
    $social = dynamic_sidebar('Social Menu');
    return $social . $menu;
    }

    ?>