Site icon WP Smith

Conditionally Remove Post Info from Posts Using Custom Fields

So recently, someone asked me how to remove post info only from specific posts using custom fields. Here is what I came up with:

First, set your custom field name to whatever you'd like it to be. I used no_post_info. And then set its value. I used true, but it really can be anything (other than false or null).

Then add to your functions.php:
[php]<?php
add_filter('genesis_post_info', 'wps_post_info_filter');
function wps_post_info_filter($post_info) {
if (genesis_get_custom_field('no_post_info')) //again, no_post_info can be whatever you name your custom field
$post_info = '';
return $post_info;
}
[/php]