How to modify authors list template

Molongui » Help » Molongui Authorship Docs » How to modify authors list template

Molongui Authorship Pro allows you easily display a list of all authors in your site. 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/authors_list/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/authors_lists/template', 'my_authors_list_template' );
function my_authors_list_template()
{
   return '/var/www/wordpress/wp-content/themes/my-child-theme/templates/molongui-authors-list.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 $authors variable, which is an array of arrays, each one containing data for a different author. 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/molongui-authorship-pro/views/authors-list/ folder.

Updated on April 27, 2023

Did not find a solution? We are here to help you succeed.
Open a support ticket