Make WordPress Core

Ticket #39350: 39350.1.patch

File 39350.1.patch, 3.3 KB (added by sami.keijonen, 8 years ago)
  • src/wp-content/themes/twentyseventeen/inc/icon-functions.php

     
    163163add_filter( 'nav_menu_item_title', 'twentyseventeen_dropdown_icon_to_menu_link', 10, 4 );
    164164
    165165/**
     166 * Display SVG social link icons in custom menu widget.
     167 *
     168 * @param  array   $nav_menu_args An array of arguments passed to wp_nav_menu().
     169 * @param  WP_Term $nav_menu      Nav menu object.
     170 * @param  array   $args          Display arguments for the current widget.
     171 * @param  array   $instance      Array of settings for the current widget.
     172 * @return array   $nav_menu_args An array of arguments passed to wp_nav_menu() with social icons.
     173 */
     174function twentyseventeen_widget_social_menu( $nav_menu_args, $nav_menu, $args, $instance ) {
     175        if ( ! has_nav_menu( 'social' ) ) {
     176                return $nav_menu_args;
     177        }
     178
     179        $menu_location = 'social';
     180        $menu_name     = wp_get_nav_menu_object( get_nav_menu_locations( $menu_location )[ $menu_location ] )->name;
     181
     182        if ( $menu_name === $nav_menu->name ) {
     183                $nav_menu_args['theme_location']  = 'social';
     184                $nav_menu_args['link_before']     = '<span class="screen-reader-text">';
     185                $nav_menu_args['link_after']      = '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) );
     186                $nav_menu_args['menu_class']      = 'social-links-menu';
     187                $nav_menu_args['depth']           = 1;
     188                $nav_menu_args['container_class'] = 'widget-social-navigation';
     189        }
     190
     191        return $nav_menu_args;
     192}
     193add_filter( 'widget_nav_menu_args', 'twentyseventeen_widget_social_menu', 10, 4 );
     194
     195/**
    166196 * Returns an array of supported social links (URL and icon name).
    167197 *
    168198 * @return array $social_links_icons
  • src/wp-content/themes/twentyseventeen/style.css

     
    23052305
    23062306/* Social nav */
    23072307
    2308 .social-navigation {
     2308.social-navigation,
     2309.widget-social-navigation {
    23092310        font-size: 16px;
    23102311        font-size: 1rem;
    23112312        margin-bottom: 1em;
    23122313}
    23132314
    2314 .social-navigation ul {
     2315.social-navigation ul,
     2316.widget-social-navigation ul {
    23152317        list-style: none;
    23162318        margin-bottom: 0;
    23172319        margin-left: 0;
    23182320}
    23192321
    2320 .social-navigation li {
     2322.social-navigation li,
     2323.widget-social-navigation li {
    23212324        display: inline;
    23222325}
    23232326
    2324 .social-navigation a {
     2327.social-navigation a,
     2328.widget-social-navigation a {
    23252329        background-color: #767676;
    23262330        -webkit-border-radius: 40px;
    23272331        border-radius: 40px;
     
    23342338}
    23352339
    23362340.social-navigation a:hover,
    2337 .social-navigation a:focus {
     2341.social-navigation a:focus,
     2342.widget .widget-social-navigation a:hover,
     2343.widget .widget-social-navigation a:focus {
    23382344        background-color: #333;
    23392345}
    23402346
    2341 .social-navigation .icon {
     2347.widget .widget-social-navigation a:hover,
     2348.widget .widget-social-navigation a:focus {
     2349        webkit-box-shadow: none;
     2350        box-shadow: none;
     2351        color: #fff;
     2352}
     2353
     2354.social-navigation .icon,
     2355.widget-social-navigation .icon {
    23422356        height: 16px;
    23432357        top: 12px;
    23442358        width: 16px;
     
    23452359        vertical-align: top;
    23462360}
    23472361
     2362.widget .widget-social-navigation ul li {
     2363        border-bottom: 0;
     2364        border-top: 0;
     2365        padding: 0;
     2366}
     2367
    23482368/* Site info */
    23492369
    23502370.site-info {