2015-06-05 68 views
0

我希望按钮隐藏时它仍然是遗憾的只有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>'; 
+0

...不明白你的问题。再试一次,再好一点。什么是空的?什么是隐藏按钮(在你的代码中没有按钮,隐藏意味着它不在HTML中,或者被CSS隐藏,...?) – panther

回答

0

我不明白你的问题。 你能提供详细的代码吗?

我认为你应该使用

if($infobox_type!= ''){ 

// show th button . 
}