2015-06-05 66 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 . 
}