ClockWorkBlogger » Page 'Sobek`s Posts by Author Plugin'

Sobek`s Posts by Author Plugin

Sobek`s Posts by Author plugin is a Wordpress 2.3+ plugin, which allows you to list the posts and pages written by one or more authors.

“Can do” statements

  • Can display the posts and pages written by one or more authors as joint or seperate lists
  • Can sort the output by post title, date or number of comments
  • Can display the number of posts that were listed in one call and the number of comments for each post
  • Can be called multiple times in a single page or post

Requirements

  • Wordpress 2.3 or above
  • PHP Exec plugin or similar to be able to make php calls within pages or posts

Download

Version history

  • v1.0.1 (November 14th, 2007) – fixed bug that would dispaly all posts instead of those by the selected author(s)
  • v1.0 (October 31st, 2007) – basic working version

Installation

  1. unzip downloaded file
  2. upload sobeks_posts_by_author.php to your “wp-content/plugins” folder
  3. enable the plugin on the “Plugins” tab in your administration area

Basic usage

  1. enter

    <?php sobeks_posts_by_author(xyz) ; ?>

    anywhere on your page you want the list of posts to be displayed

  2. replace “xyz” with the ID of the author whose posts you want to display eg.

    <?php sobeks_posts_by_author(3) ; ?>

    to list the posts of more than one author as one list replace xyz with a comma separated list of author IDs eg.

    <?php sobeks_posts_by_author(3,1,5) ; ?>

  3. enclose the function call with “<ul>” and “</ul>” eg.

    <ul><?php sobeks_posts_by_author(3,1,5) ; ?></ul>

  4. Repeat steps 1-3 for as many seperate author listings as you need

Advanced usage

Sobek`s Posts by Author plugin currently supports the following tags. If you choose not to use them, a built-in default value will be used in their place (i.e. nothing will break):

  1. “title” / “date” / “commentsort” – sorts the output by title, date or number of comments. Defaults to “title” eg.

    <?php sobeks_posts_by_author(3,1) ; ?>

    will produce the same result as

    <?php sobeks_posts_by_author(‘title’,3,1) ; ?>

    whereas this call will produce the same list of posts sorted by date:

    <?php sobeks_posts_by_author(‘date’,3,1) ; ?>

    and this call yet again the same posts, this time sorted by “most commented”:

    <?php sobeks_posts_by_author(‘commentsort’,3,1) ; ?>

  2. “count” / “nocount” – hides or shows the number of posts displayed in one call. If shown the “number of posts” information is the first item of the list displayed. Defaults to “nocount” eg.

    <?php sobeks_posts_by_author(3,1) ; ?>

    will produce the same result as

    <?php sobeks_posts_by_author(‘nocount’,‘title’,3,1) ; ?>

    whereas this call will produce the same list with the first list item being an information about how many posts are displayed:

    <?php sobeks_posts_by_author(‘count’,3,1) ; ?>

  3. “comments” / “nocomments” – hides or shows the number of comments to a post. Defaults to “nocomments” eg.

    <?php sobeks_posts_by_author(3,1) ; ?>

    will produce the same result as

    <?php sobeks_posts_by_author(‘nocomments’,‘title’,3,1) ; ?>

    whereas this will display the same list with the number of comments shown i brackets after the link to a post:

    <?php sobeks_posts_by_author(‘comments’,3,1) ; ?>

Examples

  • The sitemap of this page here (scroll down to the heading “Łukasz Sobek”, the posts are ordered by date)

CSS Styling

To style the output of the list just assign a class or ID to the “<ul>” tag eg.

<ul class=”helpful”><?php sobeks_posts_by_author(3,1) ; ?></ul>

and modify your wordpress css file to style the entries of the list.

PS. If you want an ordered list, you my want to enclose the call within <ol> tags eg.

<ol><?php sobeks_posts_by_author(3,1) ; ?></ol>

Related plugins

  • Wp-authors provides an “Authors” widget in the sidebar, useful for identifying all the different authors in a multi-author blog.
  • Authornotify is a wordpress plugin to show a message box in all the posts by a particular author.

Worth reading

Like this post? Spread the word!
delicious digg google
stumbleupon technorati Yahoo!

17 comments to “Sobek`s Posts by Author Plugin”

Like my work?

Amount:
Website(Optional):

Leave a comment