[wp-trac] [WordPress Trac] #39350: Twenty Seventeen: Customise location of the Social Links Menu

WordPress Trac noreply at wordpress.org
Sun Dec 25 12:12:44 UTC 2016


#39350: Twenty Seventeen: Customise location of the Social Links Menu
--------------------------------------+------------------------------
 Reporter:  pento                     |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Bundled Theme             |     Version:  4.7
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:
--------------------------------------+------------------------------

Comment (by sami.keijonen):

 How about like this:

 {{{
 function prefix_widget_social_menu( $nav_menu_args, $nav_menu, $args,
 $instance ) {
         $menu_location = 'social';
         $menu_name     = wp_get_nav_menu_object( get_nav_menu_locations(
 $menu_location )[ $menu_location ] )->name;

         if ( $nav_menu->name !== $menu_name || ! has_nav_menu( 'social' )
 ) {
                 return $nav_menu_args;
         }

         $nav_menu_args['theme_location'] = 'social';
         $nav_menu_args['link_before']    = '<span class="screen-reader-
 text">';
         $nav_menu_args['link_after']     = '</span>' .
 twentyseventeen_get_svg( array( 'icon' => 'chain' ) );
         $nav_menu_args['menu_class']     = 'social-links-menu';
         $nav_menu_args['depth']          = 1;

         return $nav_menu_args;
 }
 add_filter( 'widget_nav_menu_args', 'prefix_widget_social_menu', 10, 4 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39350#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list