# betterdocs/4.2.0/views/widgets/author.php

BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ &amp; Chatbot, version 4.2.0. 22 lines.

- Page: https://pluginprobe.com/plugins/betterdocs/4.2.0/code/views/widgets/author.php
- Raw: https://pluginprobe.com/plugins/betterdocs/4.2.0/raw/views/widgets/author.php
- Modified: 2025-02-12T08:51:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/betterdocs/4.2.0/code/views/widgets/author.php#L10-L20`.

```php
<?php

    // Get the author's ID
    $author_id = get_post_field( 'post_author', get_the_ID() );

    // Get the author's avatar with a specified size
    $avatar_size   = 40;
    $author_avatar = get_avatar( $author_id, $avatar_size );
    $authors_url   = site_url() . '/' . betterdocs()->settings->get( 'docs_slug' ) . '/authors/' . $author_id . '/page/1';

?>

<a class="betterdocs-author-date" href="<?php echo $authors_url; ?>">
    <div class="betterdocs-author">
        <?php
            echo '<div class="author-avatar">' . $author_avatar . '</div>';
            echo '<span>' . get_the_author_meta( 'display_name', $author_id ) . '</span>';
        ?>
    </div>
    <?php betterdocs()->views->get( 'template-parts/update-date' );?>
</a>

```
