Search
Close this search box.
				
					
<?php
/*
Template Name: Authors Page
*/
get_header(); ?>

<div id="primary" class="content-area">
    <main id="main" class="site-main">
        <?php
        // Get all users with the 'author' role
        $authors = get_users(array(
            'role' => 'author',
            'orderby' => 'display_name',
            'order' => 'ASC'
        ));

        if (!empty($authors)) {
            echo '<div class="authors-list">';
            foreach ($authors as $author) {
                echo '<div class="author">';
                echo get_avatar($author->ID, 96); // Display author avatar
                echo '<h3>' . esc_html($author->display_name) . '</h3>'; // Display author name
                echo '<p>' . esc_html(get_the_author_meta('description', $author->ID)) . '</p>'; // Display author bio
                echo '<a href="' . esc_url(get_author_posts_url($author->ID)) . '">View Posts</a>'; // Link to author's posts
                echo '</div>';
            }
            echo '</div>';
        } else {
            echo '<p>No authors found.</p>';
        }
        ?>
    </main><!-- #main -->
</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>