A long-time feature of Genesis is what is called an ‘author box’. This is a box that corresponds to an author and includes:
- a heading of ‘About Brian Gardner’, where ‘Brian Gardner’ is the author’s preferred name
- the author’s picture, which is the Gravatar associated with his/her email address
- the author’s biographical info.
To output an author box, the function to use is
This is a very flexible function. It can be called up directly or added to an action hook. You can specify the context to allow for nuanced markup. Finally, you can select to either echo the author box or return it for later use in your code.
You will want to use a hook to control where to output the author box. Just replace
your_desired_hook in the example below with the name of your desired hook.
For more granular control over the output of the author box, and to use arguments (see further below for details), you can write your own function similar to the example below. Again, replace
your_desired_hook with the name of your desired hook.
genesis_author_box accepts the following arguments, in order:
$context – the context in which you are including an author box. Specifying the context as ‘single’ will prevent the author box title being marked up with
<h1>. Currently, no other value of this argument has a unique effect, but you could potentially use it in conjunction with the filters on this function (see below).
$echo – whether to echo the author box instead of return it.
$echo is false,
genesis_author_box will return the marked up author box for later use in your code. If
$echo is true, it will echo the author box instead.
There are 3 filters on this function:
genesis_author_box_title – use this to edit or replace the default author box title. The default is ‘About Brian Gardner’, where ‘Brian Gardner’ is the author’s preferred name. You can use HTML as well as text.
genesis_author_box_gravatar_size – use this to customize the size of the author’s picture. For example, specifying 100 would result in a 100×100 picture. The default is 70, which results in a 70×70 picture.
genesis_author_box – the entire marked up content of the author box is passed to this filter immediately before echoing or returning it. You can use the filter to tweak the content using PHP string functions, or replace it altogether.
The author box markup structure for HTML5 is as follows:
The author box markup structure for HTML5 (single context) is as follows:
The author box markup structure for XHTML is as follows:
The author box markup structure for XHTML (single context) is as follows:
Note on Markup Structure
If the author box is used on an author archive that also includes an archive headline, the single context version of the author box is used instead. The reason is because the archive headline also adds an H1 element and there should only be one H1 element in the document.
The same thing will also happen if your child theme supports accessible headings, because this automatically adds an archive headline to author archives.
The Genesis settings system lets you activate the author box in two places:
- at the bottom of single Posts by the relevant author
- at the top of the author’s archive
Both settings are activated via the author’s user profile settings and are off by default.
genesis_author_box has been included since version 1.3.0.
genesis_author_box is located in lib/structure/post.php.
- How to Add Archive Headlines and Intro Text with Genesis
- How to Insert Content After the Entry with Genesis
- How to Make an Accessible Child Theme with Genesis
- How to Edit the Author Box Title with Genesis
- How to Edit the Author Box Gravatar Size with Genesis
- How to Edit the Output of the Author Box with Genesis