如果metabox为空,则按钮隐藏


if metabox is empty, button hide

我希望按钮隐藏时,它是空的,不幸的是,只有HTML之前,即使按钮已经是空的,我怎么能重写代码,使按钮隐藏?

function cspm_infobox_content(){
        $telnr = get_post_meta( $post_id, 'telnr', true );
        $email = get_post_meta( $post_id, 'email', true );
  .........
 elseif($infobox_type == 'cspm_type5'){
                $output .= '<div class="cspm_infobox_content">';
                    $output .= '<div>';
                        $output .= '<div class="telnr"><a class="wm-button color-read" href="tel:'.$telnr.'"><img src="Phone-18-18-dimenzionet.png" height="18" width="18"></a>';
                                                $output .= '<a class="wm-button color-blue email" href="mailto:'.$email.'"><img src="email-ico.png" height="18" width="18"></a></div>';

我没理解你的问题。能否提供详细代码

我认为你应该使用

if($infobox_type!= ''){
// show th button .
}