Make WordPress Core

Changeset 30273


Ignore:
Timestamp:
11/07/2014 05:37:36 PM (11 years ago)
Author:
iandstewart
Message:

Twenty Fifteen: Removing email obfuscation from social links menu.

We really should be doing this in all menus, at which point this becomes core or plugin functionality, not a theme feature.

Closes #30214.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r30270 r30273  
    303303
    304304/**
    305 * Encode email address of mailto: links in social navigation
    306 *
    307 * @since Twenty Fifteen 1.0
    308 *
    309 * @param array   $atts        HTML attributes in an associative array
    310 * @param WP_Post $item        Menu item object
    311 * @param array   $args        Array containing config with desired markup of nav
    312 *
    313 * @return array HTML attributes for Menu item
    314 */
    315 function twentyfifteen_nav_encode_email( $atts, $item, $args ) {
    316     if ( 'social' == $args->theme_location ) {
    317         if ( preg_match( '/^mailto:(.+)/', $atts['href'], $match ) ) {
    318             $atts['href'] = 'mailto:' . antispambot( $match[1] );
    319         }
    320     }
    321     return $atts;
    322 }
    323 add_filter( 'nav_menu_link_attributes', 'twentyfifteen_nav_encode_email', 10, 3 );
    324 
    325 /**
    326305 * Add a `screen-reader-text` class to the search form's submit button.
    327306 *
Note: See TracChangeset for help on using the changeset viewer.