I am trying to hide the pages H1 header IF a custom field specifies this.
On a page back end I have added a custom field: Name = hide_title Value = true
I then want to hide only the H1 using a filter.
The following code does not work but is the result of my noodling around. Can anyone suggest a fix for this code or an alternate way of approaching this. I do not want to amend the core template files.
Thanks
// Hide H1 Title
add_filter('the_title', 'hide_title', 10, 2);
function hide_title($title, $id) {
global $post;
$key = 'hide_title';
$meta = get_post_meta($post->ID, $key, true);
if ($meta = 'true') $title['post_title'] = '';
return $title;
}