Make WordPress Core

Ticket #39844: author-template.php.patch

File author-template.php.patch, 1.7 KB (added by SirkoSchindler, 8 years ago)
  • author-template.php

     
    243243/**
    244244 * Retrieves an HTML link to the author page of the current post's author.
    245245 *
    246  * Returns an HTML-formatted link using get_author_posts_url().
     246 * Returns an HTML-formatted link using get_author_posts_url() or the author name if the link is empty.
    247247 *
    248248 * @since 4.4.0
    249249 *
    250250 * @global object $authordata The current author's DB object.
    251251 *
    252  * @return string An HTML link to the author page.
     252 * @return string An HTML link to the author page or the author name.
    253253 */
    254254function get_the_author_posts_link() {
    255255        global $authordata;
     
    257257                return;
    258258        }
    259259
    260         $link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
    261                 esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
    262                 /* translators: %s: author's display name */
    263                 esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
    264                 get_the_author()
    265         );
     260        $author         =       get_the_author();
     261        $url                    = esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) );
    266262
     263        if ( empty( $url ) || 'http://' == $url )
     264                $return = $author;
     265        else
     266                $return = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
     267                                                                $link,
     268                                                                /* translators: %s: author's display name */
     269                                                                esc_attr( sprintf( __( 'Posts by %s' ), $author ) ),
     270                                                                $author
     271                                                        );
     272
    267273        /**
    268274         * Filters the link to the author page of the author of the current post.
    269275         *
     
    271277         *
    272278         * @param string $link HTML link.
    273279         */
    274         return apply_filters( 'the_author_posts_link', $link );
     280        return apply_filters( 'the_author_posts_link', $return );
    275281}
    276282
    277283/**