WP SITES

2952 Tutorials & 191 Plugins

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?