'', 'title' => '', 'desc' => '', 'fallback' => false, ); // Parse args. $args = wp_parse_args( $args, $defaults ); // Set aria hidden. $aria_hidden = ' aria-hidden="true"'; // Set ARIA. $aria_labelledby = ''; if ( $args['title'] ) { $aria_hidden = ''; $unique_id = uniqid(); $aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"'; if ( $args['desc'] ) { $aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"'; } } // Begin SVG markup. $svg = ''; // Display the title. if ( $args['title'] ) { $svg .= '' . esc_html( $args['title'] ) . ''; // Display the desc only if the title is already set. if ( $args['desc'] ) { $svg .= '' . esc_html( $args['desc'] ) . ''; } } $svg .= ' '; // Add some markup to use as a fallback for browsers that do not support SVGs. if ( $args['fallback'] ) { $svg .= ''; } $svg .= ''; return $svg; } function noteworthy_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Get supported social icons. $social_icons = noteworthy_social_links_icons(); // Change SVG icon inside social links menu if there is supported URL. if ( 'social-nav' === $args->theme_location ) { foreach ( $social_icons as $attr => $value ) { if ( false !== strpos( $item_output, $attr ) ) { $item_output = str_replace( $args->link_after, '' . noteworthy_get_svg( array( 'icon' => esc_attr( $value ) ) ), $item_output ); } } } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'noteworthy_nav_menu_social_icons', 10, 4 ); function noteworthy_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) { if ( 'top' === $args->theme_location ) { foreach ( $item->classes as $value ) { if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) { $title = $title . noteworthy_get_svg( array( 'icon' => 'angle-down' ) ); } } } return $title; } add_filter( 'nav_menu_item_title', 'noteworthy_dropdown_icon_to_menu_link', 10, 4 ); function noteworthy_social_links_icons() { // Supported social links icons. $social_links_icons = array( 'behance.net' => 'behance', 'codepen.io' => 'codepen', 'deviantart.com' => 'deviantart', 'digg.com' => 'digg', 'dribbble.com' => 'dribbble', 'dropbox.com' => 'dropbox', 'facebook.com' => 'facebook', 'flickr.com' => 'flickr', 'foursquare.com' => 'foursquare', 'plus.google.com' => 'google-plus', 'github.com' => 'github', 'instagram.com' => 'instagram', 'linkedin.com' => 'linkedin', 'mailto:' => 'envelope-o', 'medium.com' => 'medium', 'pinterest.com' => 'pinterest-p', 'getpocket.com' => 'get-pocket', 'reddit.com' => 'reddit-alien', 'skype.com' => 'skype', 'skype:' => 'skype', 'slideshare.net' => 'slideshare', 'snapchat.com' => 'snapchat-ghost', 'soundcloud.com' => 'soundcloud', 'spotify.com' => 'spotify', 'stumbleupon.com' => 'stumbleupon', 'tumblr.com' => 'tumblr', 'twitch.tv' => 'twitch', 'twitter.com' => 'twitter', 'vimeo.com' => 'vimeo', 'vine.co' => 'vine', 'vk.com' => 'vk', 'wordpress.org' => 'wordpress', 'wordpress.com' => 'wordpress', 'yelp.com' => 'yelp', 'youtube.com' => 'youtube', ); return apply_filters( 'noteworthy_social_links_icons', $social_links_icons ); }