Changeset 61745 for trunk/src/wp-includes/author-template.php
- Timestamp:
- 02/26/2026 02:34:53 AM (9 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/author-template.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/author-template.php
r61454 r61745 230 230 * 231 231 * @since 3.0.0 232 * @since 7.0.0 Added `$use_title_attr` parameter. 232 233 * 233 234 * @global WP_User $authordata The current author's data. 234 235 * 236 * @param bool $use_title_attr Optional. Whether to add a title attribute. 237 * Default true. 235 238 * @return string An HTML link if the author's URL exists in user meta, 236 239 * otherwise the result of get_the_author(). 237 240 */ 238 function get_the_author_link( ) {241 function get_the_author_link( $use_title_attr = true ) { 239 242 if ( get_the_author_meta( 'url' ) ) { 240 243 global $authordata; … … 243 246 $author_display_name = get_the_author(); 244 247 248 /* translators: %s: Author's display name. */ 249 $author_title = sprintf( __( 'Visit %s’s website' ), $author_display_name ); 250 245 251 $link = sprintf( 246 '<a href="%1$s" title="%2$s"rel="author external">%3$s</a>',252 '<a href="%1$s"%2$s rel="author external">%3$s</a>', 247 253 esc_url( $author_url ), 248 /* translators: %s: Author's display name. */ 249 esc_attr( sprintf( __( 'Visit %s’s website' ), $author_display_name ) ), 254 $use_title_attr ? ' title="' . esc_attr( $author_title ) . '"' : '', 250 255 $author_display_name 251 256 ); … … 275 280 * 276 281 * @since 2.1.0 277 */ 278 function the_author_link() { 279 echo get_the_author_link(); 282 * @since 7.0.0 Added `$use_title_attr` parameter. 283 * 284 * @param bool $use_title_attr Optional. Whether to add a title attribute. 285 * Default true. 286 */ 287 function the_author_link( $use_title_attr = true ) { 288 echo get_the_author_link( $use_title_attr ); 280 289 } 281 290 … … 311 320 * 312 321 * @since 4.4.0 322 * @since 7.0.0 Removed title attribute. 313 323 * 314 324 * @global WP_User $authordata The current author's data. … … 323 333 } 324 334 335 $author = get_the_author(); 336 /* translators: %s: Author's display name. */ 337 $title = sprintf( __( 'Posts by %s' ), $author ); 338 325 339 $link = sprintf( 326 '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',340 '<a href="%1$s" rel="author">%2$s</a>', 327 341 esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ), 328 /* translators: %s: Author's display name. */ 329 esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), 330 get_the_author() 342 $author 331 343 ); 332 344 … … 335 347 * 336 348 * @since 2.9.0 337 * 338 * @param string $link HTML link. 339 */ 340 return apply_filters( 'the_author_posts_link', $link ); 349 * @since 7.0.0 Added `$author` and `$title` parameters. 350 * 351 * @param string $link HTML link. 352 * @param string $author Author's display name. 353 * @param string $title Text originally used for a title attribute. 354 */ 355 return apply_filters( 'the_author_posts_link', $link, $author, $title ); 341 356 } 342 357 … … 537 552 538 553 $link = sprintf( 539 '<a href="%1$s" title="%2$s">%3$s</a>',554 '<a href="%1$s">%2$s</a>', 540 555 esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ), 541 /* translators: %s: Author's display name. */542 esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ),543 556 $name 544 557 );
Note:
See TracChangeset
for help on using the changeset viewer.