Table of Contents

Modify the PHP Output in Themes for Authors

You are here:

The PublishPress Authors plugin allows you to show author profiles using this a snippet of PHP code. This code can be modified in many way to suit your needs.

Don't worry if you're not technical. There are also other ways to show your authors that require no code.

We recommend that you add these code snippets to a child theme, as that is best practice for WordPress theme development. We do have child themes available for some popular themes.

It is also possible to use the PublishPress Authors API to show external data.

The basic Authors code

This is the most basic PHP code to load the authors for a post:

<?php do_action( 'pp_multiple_authors_show_author_box' ); ?>

Expanding the code: the title

You can modify this basic code in several ways. The first argument you can can add to the code will control the title.

Here is one example with the first argument set to false.

<?php do_action('pp_multiple_authors_show_author_box', false); ?>

In this code, false will hide the title of the authors area. If you change this to true, the title for the area will appear.

Expanding the code: layout

The second argument you can add to this code will control the layout. Here is an example using the boxed layout:

<?php do_action('pp_multiple_authors_show_author_box', false, 'boxed'); ?>

You can also change this to one of the other layout options:

  • simple_list
  • centered
  • boxed
  • inline
  • inline_avatar

Expanding the code: author pages

The third argument allows you to use this code on the author pages of your site. These are the individual author pages you see at URLs like this:


The true in the third argument of this code will force it to detect the author from the current URL, instead of from the current post. This means it can be used to display the author's information on the page header, for the current author.

<?php do_action('pp_multiple_authors_show_author_box', false, 'boxed', true); ?>

For the posts loop in the author page, you have to keep the false in the third argument and follow the instructions below (for archive pages) so it will display the authors of the current post in the loop.

Expanding the code: archive pages

By default, the basic code shown at the top of this guide will only display the author box for a single post page.

The fourth argument allows you to use this code in the posts loop on archive/author pages or on the homepage of your site. The true in the fourth argument of this code will force it to run whenever used, not just inside a single post loop. It is important to also keep the third argument as false in this case.

<?php do_action('pp_multiple_authors_show_author_box', false, 'boxed', false, true); ?>

Professional publishing plugins for WordPress! Get PublishPress