• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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

  • Display Genesis Author Box Using Checkbox
  • Remove Genesis Author Box From Single Post
  • Add or Remove Author Box Only When Custom Field Has Value

Author Box

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.