Created
July 24, 2013 15:34
-
-
Save WerdsWords/6071681 to your computer and use it in GitHub Desktop.
#18: pre_link_description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace link description with last-edited date and time | |
* | |
* @see sanitize_bookmark_field() | |
* | |
* @param string $value The original link description. | |
* | |
* @return string The last-edited date and time. | |
*/ | |
function wpdocs_pre_link_description( $value ) { | |
// Combines date_format and time_format together | |
$date_time_format = sprintf( '%1$s, %2$s', get_option( 'date_format' ), get_option( 'time_format' ) ); | |
// Combines 'Last Edited: ' with the localized date/time format | |
$last_edited = sprintf( __( 'Last Edited: %s', 'yourtextdomain' ), date_i18n( $date_time_format ) ); | |
return esc_attr( $last_edited ); | |
} | |
add_filter( 'pre_link_description', 'wpdocs_pre_link_description' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment