Legacy: Add External Data to PublishPress Authors

This version of the Layouts feature has been retired. PublishPress Authors is now using a new approach called “Author Boxes“.

It is possible to send your own data for display inside PublishPress Authors.

The filter publishpress_authors_author_attribute is not used in the layout code. However it is a hook that allows plugins to inject additional properties to the author object in the custom layouts.

One example of this is the PublishPress Authors integration with BuddyPress.

Here is how you can use the filter inside a plugin:

add_filter('publishpress_authors_author_attribute', 'filterAuthorAttributes', 10, 3);
function filterAuthorAttributes($value, $termId, $attribute)
    if ($attribute === 'newproperty') {
        // Add the conditionals or code required to retrieve the value you want.
        $value = 'awesome';
    return $value;

And this code shows how can use that new property inside a layout:

{% for author in authors %}
	{% if author.newproperty %}
		// ...
	{% endif %}
	// OR
	{{ author.newproperty }}
{% endfor %}

You may also be interested in details of the PublishPress Authors API.

Professional publishing plugins for WordPress! Get PublishPress