| 297 | * Encode email address of mailto: links in social navigation |
| 298 | * |
| 299 | * @since Twenty Fifteen 1.0 |
| 300 | * |
| 301 | * @param array $atts HTML attributes in an associative array |
| 302 | * @param WP_Post $item Menu item object |
| 303 | * @param array $args Array containing config with desired markup of nav |
| 304 | * |
| 305 | * @return array HTML attributes for Menu item |
| 306 | */ |
| 307 | function twentyfifteen_nav_encode_email( $atts, $item, $args ) { |
| 308 | if ( 'social' == $args->theme_location ) { |
| 309 | if ( preg_match( '/^mailto:(.+)/', $atts['href'], $match ) ) { |
| 310 | $atts['href'] = 'mailto:' . antispambot( $match[1] ); |
| 311 | } |
| 312 | } |
| 313 | return $atts; |
| 314 | } |
| 315 | add_filter( 'nav_menu_link_attributes', 'twentyfifteen_nav_encode_email', 10, 4 ); |
| 316 | |
| 317 | /** |