How to remove post info from a specific post in Genesis

Posted on

In my previous tutorial titled How to remove Post info conditionally in Genesis, I shared code to remove post info from

  1. all archives
  2. posts on a Page that uses Blog Page Template
  3. all entries of a particular CPT

What if you want to get rid of the post info from a particular post or a Custom Post Type single entry page?

Adding

/**
 * Remove post info from a specific single post/CPT page
 *
 * @author Sridhar Katakam
 * @link   https://sridharkatakam.com/
 */
add_action( 'genesis_before_entry', function () {
	// if this is not a single page having a title of "Membership 1", abort.
	if ( ! is_single( 'Membership 1' ) ) {
		return;
	}

	remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
} );

in child theme’s functions.php will not display the entry meta in entry header aka post info just on this page.

You’d need to replace Membership 1 in the code with the title of your Post/CPT.