2012-03-08 34 views
0

我對PHP相當陌生,任何幫助將非常感謝。wordpress條款存在條件不起作用?

我正在wordpress中的一個循環內運行這個。

我創建了一個名爲文件格式的分類法,下面這些術語(pdf,mov,ppt)在我的文件格式分類中。

而且我想呼應特異性的東西,取決於其任期後是英寸

但低於PHP腳本似乎只是制動網站:-(任何一個可以幫助?

<?php 

    if (term_exists('term'=> 'pdf')) 
    { 
     echo 'PDF' ; 
    } 
    else if (term_exists('term'=> 'ppt')) 
    { 
     echo 'PPT' ; 
    } 
    else (term_exists('term'=> 'mov')) 
    { 
     echo 'MOV' ; 
    } 

?> 

感謝 喬希




UPDATE

這仍然沒有工作...

<?php 

    if (term_exists('term' => 'pdf')) { 

     echo 'PDF' ; 

    } 
    else if (term_exists('term' => 'ppt')) { 

     echo 'PPT' ; 

    } 
    else if (term_exists('term' => 'mov')) { 

     echo 'MOV' ; 

    } 
    else { 

     echo '' ; 

    } 

?> 

回答

0

檢查其他部分,應該是:

 

if (term_exists('term', 'pdf')) { 
    echo 'PDF' ; 
} 
else if (term_exists('term', 'ppt')) { 
    echo 'PPT' ; 
} 
else { 
    echo 'MOV' ; 
} 
 

編號:term_exists($term, $taxonomy)

+0

感謝您的快速回應... '<?PHP的 \t如果(term_exists( '術語'=>'PDF')){ \t \t 回聲\t 'PDF'; \t \t \t }否則如果(term_exists( '術語'=> 'PPT')){ \t \t 回波\t 'PPT'; \t \t \t }否則如果(term_exists( '術語'=> 'MOV')){ \t \t 回波\t 'MOV'; \t \t \t }否則{ \t \t 回波\t ''; \t \t} \t ?> ' 但仍無法正常工作?獲取白色屏幕 – Joshc 2012-03-08 11:40:49

+0

注意到'term_exists'函數的用法 – 2012-03-08 12:15:30