-1
我試圖爲我創建的自定義分類標準創建一個php else if語句,但它似乎只顯示第一個?我已經迴應了這個變量,它是正確的?任何幫助,將不勝感激。分類法PHP其他如果聲明不工作?
<?php
$genre = get_the_term_list($post->ID, 'genre');
if ($genre = "Action") {
echo "Action" ;
} elseif ($genre = "Thriller") {
echo "Thriller" ;
} elseif ($genre = "Horror") {
echo "Horror" ;
}
?>
您也可以使用['switch'](http://php.net/manual/en/control-structures.switch.php)語句,因爲您在每個if語句中使用'$ genre', condifition。 –