Customizing Which Posts the Authors Box Displays On

The Multiple Authors plugin allows you to show author details in your plugin or theme.

You can use the action “pp_multiple_authors_show_author_box” to display the author box programmatically:

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

Customizing the author box

By default, the author box under content is only displayed in the Post or Page post types. There are other ways to display authors, but if you want author boxes on more post types, you can use this filter:

<?php
add_filter( 'pp_multiple_authors_post_types', 'my_custom_post_type_filter' );

function my_custom_post_type_filter( $post_types ) {
    $post_types['my_custom_postype'] = esc_html__( 'MY Custom Post Type' );

    return $post_types;
}
?>

Change when the post type is visible

By default, the author box under content only works on the following conditions:

  • Is not the homepage
  • Is not a category page
  • Is a single post or page
  • Is a valid post type

You can change the result of the conditions test using the following filter:

<?php
add_filter( 'pp_multiple_authors_filter_should_display_author_box', 'my_filter_should_display' );

function my_filter_should_display( $display ) {
    if ( $my_conditions... ) {
        $display = false;
    }

    return $display;
}
?>

Professional publishing plugins for WordPress! Get PublishPress