How to check custom fields from functions.php

I don’t know if you need to hide the element completely, as in “never display it”, or if you need to hide it conditionally with JavaScript– say, to get a toggle effect. Either case is similar and would use get_post_meta().

To conditionally display the data use something like:

$m = get_post_meta(get_the_ID(),'my_meta_key');
if(!empty($m)) {
  echo '<div>your data</div>';
}

If you want something that you can toggle with JavaScript use:

$m = get_post_meta(get_the_ID(),'my_meta_key');
$str="<div %s>your data</div>";
if(!empty($m)) {
  $str = sprintf($str,'class="'.$m.'"'); 
}
echo $str;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)