WordPress.org

Make WordPress Core

Ticket #12892: get_author_link.diff

File get_author_link.diff, 1.3 KB (added by zoranzaric, 8 years ago)

Patch that adds get_author_link()

  • wp-includes/author-template.php

     
    128128}
    129129
    130130/**
     131 * Retrieve either author's link or author's name.
     132 *
     133 * If the author has a home page set, return an HTML link, otherwise just return the
     134 * author's name.
     135 *
     136 * @uses get_the_author_meta()
     137 * @uses get_the_author()
     138 */
     139function get_author_link() {
     140        if ( get_the_author_meta('url') ) {
     141                return '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s&#8217;s website"), get_the_author()) ) . '" rel="external">' . get_the_author() . '</a>';
     142        } else {
     143                return get_the_author();
     144        }
     145}
     146
     147/**
    131148 * Display either author's link or author's name.
    132149 *
    133150 * If the author has a home page set, echo an HTML link, otherwise just echo the
     
    139156 * @uses the_author()
    140157 */
    141158function the_author_link() {
    142         if ( get_the_author_meta('url') ) {
    143                 echo '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s&#8217;s website"), get_the_author()) ) . '" rel="external">' . get_the_author() . '</a>';
    144         } else {
    145                 the_author();
    146         }
     159        echo get_author_link();
    147160}
    148161
    149162/**