Deluxe Blog Tips About Projects

How to Add Author Bio for Guest Posts in Genesis

At Deluxe Blog Tips, we have some guest posts from JayKrishna Yadav. In the end of each guest post, I display his name, bio and gravatar to let people know more about him. That author bio box is supported by Genesis framework, which I’m using for Deluxe Blog Tips. If you want to use the default Genesis author bio box, you have to create an user for your contributor, and fill in his bio. That’s good enough unless the contributor wants to show different bio in author bio box each time he writes a post, like JayKrishna Yadav does at Deluxe Blog Tips. In this post, I’ll show you how to do that with a simple meta box and a few lines of code that will replace Genesis author bio box with a custom one.

Step 1: Define meta box for guest post

To setup a meta box for guest post, I use my Meta Box plugin. The code for guest post settings is quite simple:

add_action( 'admin_init', 'dbt_guest_post_meta_box' );

function dbt_guest_post_meta_box()
    if ( !class_exists( 'RW_Meta_Box' ) )

    $prefix = 'gp_'; // Guest Post
    $meta_box = array(
        'title'  => 'Guest Post Settings',
        'fields' => array(
                'name' => 'Name',
                'id'   => "{$prefix}name",
                'type' => 'text',
                'name' => 'Email',
                'id'   => "{$prefix}email",
                'type' => 'text',
                'name' => 'Bio',
                'id'   => "{$prefix}bio",
                'type' => 'textarea',
    new RW_Meta_Box( $meta_box );

I register a meta box with 3 fields: Name (text), Email (text) and Bio (textarea). The email will be used to show author’s gravatar.

If you don’t know what the code means, please look at see how to register meta box and how to define meta fields.

The result is:

Guest Post Meta Box

Step 2: Replace Genesis author bio box by our custom one

Genesis has a filter genesis_author_box that let us change the information in author bio box. I use it to display custom author bio box:

add_filter( 'genesis_author_box', 'dbt_author_box', 10, 6 );

function dbt_author_box( $text, $context, $pattern, $gravatar, $title, $description )
    $name  = rwmb_meta( 'gp_name' );
    $email = rwmb_meta( 'gp_email' );
    $bio   = rwmb_meta( 'gp_bio' );

    if ( empty( $name ) || empty( $email ) || empty( $bio ) )
        return $text;

    $gravatar_size = apply_filters( 'genesis_author_box_gravatar_size', 70, 'single' );
    $gravatar = get_avatar( $email, $gravatar_size );

    $title = apply_filters( 'genesis_author_box_title', sprintf( '<strong>%s %s</strong>', __( 'About', 'genesis' ), $name ), 'single' );
    $description = wpautop( $bio );

    return sprintf( $pattern, $gravatar, $title, $description );

In this function, I use the helper function of meta box plugin to retrieve author information, and then pass that information to a predefined $pattern variable, which holds the HTML structure for author bio box. This makes the guest author bio box looks exactly like default author bio box.

That’s all. Let me know what you think about this method in the comments below. And if you want to do guest post at Deluxe Blog Tips, please contact me.

Bonus: I also use Revision and Meta Box plugin to create a list of contributor for each post. Read it here.

Subscribe to the Newsletter

Subscribe to get my latest content by email. I won't send you spam. Unsubscribe at any time.