Molongui Authorship Pro allows you easily display a list of posts by author. And you have different layouts to choose from. However, you might want to display the list in a very different way.
If you find yourself in such need and you have PHP coding skills, keep reading because this article is for you.
There is a convenient hook you can use to provide your very own template. The authorship_pro/author_posts/template
filter.
It filters the full path to the template to load. So you can overwrite the default one like this:
add_filter( 'authorship_pro/author_posts/template', 'my_author_posts_template' );
function my_author_posts_template()
{
return '/var/www/wordpress/wp-content/themes/my-child-theme/templates/molongui-author-posts.php';
}
So your hooked function must return the full path to your custom template. Obviously, returned value in the code above is just an example.
And which data do you have available? Basically, you have the $posts
variable, which is an array of WP_Post
objects and the $author
class. But you better check out any of the default templates packaged with the plugin. You will find them as .PHP files in the wp-content/plugins/
folder.