• Resolved tabreziqbal

    (@tabreziqbal)


    I have installed the wordpress software and have create multiple users/authors for it. i wanted to provide links in the sidebar of the blog which will take the readers to all the posts by a particular author. how to do this? creating a category for each author and asking them to add that category for all their posts doesn’t look too good to me…

Viewing 2 replies - 1 through 2 (of 2 total)
  • In the sidebar.php of your theme insert the code:

    <h5>Other Authors: </h5>
    <?php wp_list_authors();?>

    that’s how I did it…actually I only present that list on an author page, so the above code is enclosed by an if statement:

    <?php if(is_author()) : ?>

    <?php endif; ?>

    If you need to create links to author pages where the author is listed, you can use the code found here, presuming you are using permalinks. Otherwise, you’d be using ID numbers to create links.

    EDIT: apparently, there is a better way… Looking at the list_authors function, I discovered there is a method to create a link that is smart enough to know whether you are on permalinks or not:
    $link = '<#a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</#a>';

    You must ignore the # symbols in the code because they are needed to prevent the a tags from being interpreted as HTML here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘All the articles of an author’ is closed to new replies.