Exclude or Include Genesis Author Box On Specific Single Pages

By default, the author box in Genesis doesn’t display on single pages. However, you can add the following PHP code to your child themes functions file to add include & exclude certain single pages.

add_action( 'genesis_entry_footer', 'conditional_author_box' );

function conditional_author_box() {

if ( is_page(array( '128', '130' ) ) ) :

genesis_author_box( 'single' );
    
endif;
}

The above code includes the is_page() conditional tag with the page i.d’s for 2 pages, 128 & 130 which are included and all other single pages are excluded.

You could also write the code like this :

add_action( 'genesis_entry_footer', 'conditional_author_box' );

function conditional_author_box() {

if ( is_page(array( '128', '130' ) ) ) {

genesis_author_box( 'single' );
    
    }
}

You can also write the code like this using the is_single() conditional tag :

add_action( 'genesis_entry_footer', 'conditional_author_box' );

function conditional_author_box() {

if ( is_single(array( '128', '130' ) ) ) :

genesis_author_box( 'single' );
    
endif;
}

Assumes you have ticked the author box checkbox on the Users > Your Profile > Author Box > Enable Author Box on this User’s Posts?

Related Code Snippets

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.