WordPress.org

Ready to get started?Download WordPress

Forums

Link to Specific Authors Pages (4 posts)

  1. GeekElite
    Member
    Posted 4 years ago #

    Hey, All -

    I want to add links in the sidebar of my site for author's pages, but I only want 4 specific authors to show up there. I downloaded and installed an "Authors" widget that worked pretty well, except I couldn't customize it to exclude authors.

    There are only 4 contributors that I want to show up in this list. I don't want every random person who posts a comment to show up, which is what happens with the Authors widget. Can I use a blank widget and insert specific code for this function? If so, what code would I use?

    You can take a look at my site at http://www.geekerific.com. I've left the authors widget in place for now to show what I *don't* want. If you look at the page right now, I do NOT want the authors "afterthefact" or "Justin" to show up in the list.

    NOTE: I do not want to accomplish this goal by creating categories and forcing the authors to categorize posts by their name. Ultimately, I want to figure this out so I can place an author link on each author's bio page as well.

    Thanks in advance for any help!

  2. MichaelH
    Member
    Posted 4 years ago #

  3. GeekElite
    Member
    Posted 4 years ago #

    Unfortunately, no. That tag does the exact same thing that the Authors widget - it just lists every registered author on the site, and I can't seem to find a way to specify which authors get listed and/or omit the ones I don't want to see.

  4. MichaelH
    Member
    Posted 4 years ago #

    <?php
    //display selected users
    $userids_to_display = array(1,2);
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        if ( in_array($bloguser->user_id, $userids_to_display) ) {
          $user = get_userdata($bloguser->user_id);
          echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . '</p>';
        }
      }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic