Although listing all authors is certainly nice, you don't want to give undue attention to authors who haven't been active in a while. In this recipe, we're going to develop a function that returns information about the users who most recently published a post on the site.
The only requirement for this recipe is that you are working on a valid theme and that you have some place to put your author listing, ideally a sidebar file such as sidebar.php
.
First, we need to create a couple of custom template tags. We'll call the first template tag get_recently_published_author_ids
, and have it accept a single parameter that determines the number of author IDs to return. The second template tag is called get_last_post_id_published_for_author
, and it accepts a single parameter that defines the author we are looking at.
Open or create your theme's functions.php
file, and define the following functions in it:
function...