WordPress函数the_author()显示当前文章的作者名称

描述:

显示当前文章的作者名称

用法:

<?php the_author(); ?>

示例:

<p>This post was written by <?php the_author(); ?></p>

 

源文件:

function the_author( $deprecated = '', $deprecated_echo = true ) {
    if ( ! empty( $deprecated ) ) {
        _deprecated_argument( __FUNCTION__, '2.1.0' );
    }
 
    if ( true !== $deprecated_echo ) {
        _deprecated_argument(
            __FUNCTION__,
            '1.5.0',
            sprintf(
                /* translators: %s: get_the_author() */
                __( 'Use %s instead if you do not want the value echoed.' ),
                '<code>get_the_author()</code>'
            )
        );
    }
 
    if ( $deprecated_echo ) {
        echo get_the_author();
    }
 
    return get_the_author();
}