Posted by José Lopes.
While setting my site with Wordpress I created an author.php to display information about the
authors of the site, much as it is defined in Author Templates. I wanted to have
a description about the author itself and a list of posts writen by him.
This plugin displays the complete post list of one Author, with the total number, including the co-author participations.
I was having some problems setting up the authors properly so, since I didn't any thing to solve it, I created this Plugin.
The problems appeared while displaying the list of posts of the author:
- Having set the maximum number of posts to be displayed by page it was not possible to display all the author posts, if the
total posts exceeded that number.
- If the author was also co-author of other posts, theses one were not listed neither taken into account for the posts total number.
Download
You can download one of the files that serves you better:
author-complete-post-list.zip or
author-complete-post-list.tar.gz
Installation
- Descompress the file to the directory wp-content/plugins
- The directory author-complete-post-list will be created, but if not do it manually and place the Plugin files inside.
- Activate the Plugin Author Complete Post List on the administration pannel.
- You are ready to rock!
How to use it
As I said previously the Plugin was created to be used in author.php so the next example is based in this assumption.
Taking the Wordpress php
example, two code lines are enough to get the
author's post list.
<?php total_posts($author, $curauth->user_login, 'pt_PT') ; ?>
<?php full_post_list($author, $curauth->user_login, 'pt_PT') ; ?>
Explaining the code:
- The first line returns the introduction text for the post list, with the total of posts.
- The second line returns the author's post lists, including the ones in which he is co-author, sorted by the most recent post.
- Checking the function args:
- The first is defined by Wordpress and identifies the author.
- The second is defined at the top of the author.php file of Wordpress,
selecting the author login with the tag user_login.
- The third is optional, defining the output language. It accepts 'pt_PT' for portuguese and 'en_GB' for english.
By default it is set for portuguese.
Output example:
This author has 3 post(s):
- Post 3 in 06/07/2007, stored at Nowhere
- Post 2 in 06/07/2007, stored at Nowhere
- Post 1 in 05/07/2007, stored at Nowhere
Final notes
This Plugin was tested with Wordpress v.2.2, so any info about other version is welcome.
There are no special requirements to install or use this Plugin, nevertheless, since one of the major goals is to include the
co-author posts it would be wise to make attention at how you define the co-author thing. In this way I end this presentation
with the following points:
- To insert one or more co-authors in a post you can use the Plugin
multiple-authors that allows to set on Personalized Field
the key word other_author, whose value should be the co-author login name (one key for co-author).
- The use of the Plugin multiple-authors allows to
easily include several author names in the post and to automatically record the co-author if the user edits the post.
It has advantages and disadvantages because recording automatically the co-author it may include the author by mistake.
- If you don't use the Plugin, you can always use the other_author key word to manually add the author name
and my Plugin will work. It is important to keep the name other_author as the key word.
- You have to certain to place the author login name in the key word value, otherwise it will not be recognized.
- The Plugin internationalization is not yet done but it may be done in the future. However, the two language option included in
the Plugin should cover most of the needs.
Thanks