get_the_author example


    function twenty_twenty_one_posted_by() {
        if ( ! get_the_author_meta( 'description' ) && post_type_supports( get_post_type(), 'author' ) ) {
            echo '<span class="byline">';
            printf(
                /* translators: %s: Author name. */
                esc_html__( 'By %s', 'twentytwentyone' ),
                '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" rel="author">' . esc_html( get_the_author() ) . '</a>'
            );
            echo '</span>';
        }
    }
}

if ( ! function_exists( 'twenty_twenty_one_entry_meta_footer' ) ) {
    /** * Prints HTML with meta information for the categories, tags and comments. * Footer entry meta is displayed differently in archives and single posts. * * @since Twenty Twenty-One 1.0 * * @return void */
function get_the_archive_title() {
    $title  = __( 'Archives' );
    $prefix = '';

    if ( is_category() ) {
        $title  = single_cat_title( '', false );
        $prefix = _x( 'Category:', 'category archive title prefix' );
    } elseif ( is_tag() ) {
        $title  = single_tag_title( '', false );
        $prefix = _x( 'Tag:', 'tag archive title prefix' );
    } elseif ( is_author() ) {
        $title  = get_the_author();
        $prefix = _x( 'Author:', 'author archive title prefix' );
    } elseif ( is_year() ) {
        $title  = get_the_date( _x( 'Y', 'yearly archives date format' ) );
        $prefix = _x( 'Year:', 'date archive title prefix' );
    } elseif ( is_month() ) {
        $title  = get_the_date( _x( 'F Y', 'monthly archives date format' ) );
        $prefix = _x( 'Month:', 'date archive title prefix' );
    } elseif ( is_day() ) {
        $title  = get_the_date( _x( 'F j, Y', 'daily archives date format' ) );
        $prefix = _x( 'Day:', 'date archive title prefix' );
    } elseif ( is_tax( 'post_format' ) ) {
        
/** * Handles the author column output. * * @since 4.3.0 * * @param WP_Post $post The current WP_Post object. */
    public function column_author( $post ) {
        printf(
            '<a href="%s">%s</a>',
            esc_url( add_query_arg( array( 'author' => get_the_author_meta( 'ID' ) ), 'upload.php' ) ),
            get_the_author()
        );
    }

    /** * Handles the description column output. * * @since 4.3.0 * @deprecated 6.2.0 * * @param WP_Post $post The current WP_Post object. */
    

    public function column_author( $post ) {
        $args = array(
            'post_type' => $post->post_type,
            'author'    => get_the_author_meta( 'ID' ),
        );
        echo $this->get_edit_link( $argsget_the_author() );
    }

    /** * Handles the default column output. * * @since 4.3.0 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. * * @param WP_Post $item The current WP_Post object. * @param string $column_name The current column name. */
    
?> <?php if ( (bool) get_the_author_meta( 'description' ) && post_type_supports( get_post_type(), 'author' ) ) : ?> <div class="author-bio <?php echo get_option( 'show_avatars' ) ? 'show-avatars' : ''; ?>"> <?php echo get_avatar( get_the_author_meta( 'ID' ), '85' ); ?> <div class="author-bio-content"> <h2 class="author-title"> <?php             printf(
                /* translators: %s: Author name. */
                esc_html__( 'By %s', 'twentytwentyone' ),
                get_the_author()
            );
            ?> </h2><!-- .author-title --> <p class="author-description"> <?php the_author_meta( 'description' ); ?></p><!-- .author-description --> <?php             printf(
                '<a class="author-link" href="%1$s" rel="author">%2$s</a>',
                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                sprintf(
                    /* translators: %s: Author name. */
                    esc_html__( 'View all of %s\'s posts.', 'twentytwentyone' ),
                    
__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();
}

/** * Retrieves the author who last edited the current post. * * @since 2.8.0 * * @return string|void The author's display name, empty string if unknown. */
Home | Imprint | This part of the site doesn't use cookies.