-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。 –