'' ); // Parse args. $args = wp_parse_args( $args, $defaults ); $icon = ''; $icon .= ''; return $icon; } /** * Display icons in social links menu. * * @param string $item_output The menu item output. * @param WP_Post $item Menu item object. * @param int $depth Depth of the menu. * @param array $args wp_nav_menu() arguments. * @return string $item_output The menu item output with social icon. */ function canary_led_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Get supported social icons. $social_icons = canary_led_social_links_icons(); // Change icon inside social links menu if there is supported URL. if ( 'menu-3' === $args->theme_location ) { foreach ( $social_icons as $attr => $value ) { if ( false !== strpos( $item_output, $attr ) ) { $item_output = str_replace( $args->link_after, '' . canary_led_get_icons( array( 'icon' => esc_attr( $value ) ) ), $item_output ); } } } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'canary_led_nav_menu_social_icons', 10, 4 ); if(!function_exists('canary_led_social_links_icons')) { /** * Returns an array of supported social links (URL and icon name). * * @return array $social_links_icons */ function canary_led_social_links_icons() { // Supported social links icons. $social_links_icons = array( 'facebook.com' => 'facebook-f', 'twitter.com' => 'twitter', 'pinterest.com' => 'pinterest-p', 'dribbble.com' => 'dribbble', 'mailto:' => 'envelope', 'wordpress.com' => 'wordpress', 'wordpress.org' => 'wordpress', 'youtube.com' => 'youtube', 'bitcoin.org' => 'bitcoin' ); /** * Filter Zon social links icons. * * @since Zon 1.0 * * @param array $social_links_icons Array of social links icons. */ return apply_filters( 'canary_led_social_links_icons', $social_links_icons ); } }