Site icon WP Smith

Conditionally Remove Post Meta in Genesis

So as I was working through a site, I just wanted to randomly remove some post meta based on the site layout. So I thought, though unique, this may be helpful to someone sometime somewhere sooner or later.

First, by default, the post meta appears in the genesis_after_post_content hook. So you need to add an action for any hook before that hook to run the test to tell WordPress/Genesis to remove post meta or not.

Second, for the check, I wanted to remove it if it were for any other post types other than post and for any posts that was full width.

Then I remove the action that calls the post meta.

[php]
add_action ( 'genesis_post_content' , 'wps_post_meta_check' );
function wps_post_meta_check() {
global $post;

if ( ( $post->post_type != 'post' ) || ( genesis_site_layout() == 'full-width-content' ) )
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
}
[/php]