我不是php方面的专家,wordpress方面的专家更少。我想知道他们是不是太好了,我有错。我解释说,我的问题是,如果有这两个类别(或更多),我想在帖子中显示带有echo的div。我正在附上代码。非常感谢,问候!
<?php
$bflower = "This is a A";
$bmammal = "This is a B";
$cflower = "This is a C";
$cmammal = "This is a D";
if(has_category(array(\'chicken\', \'mammal\'))){
echo $cmammal; }
elseif (has_category(array(\'jasmin\', \'rose\'))) {
echo $cplant; }
elseif (has_category(array(\'aloe vera\', \'jeran\'))) {
echo $bplant; }
elseif (has_category(array(\'rabbit\', \'cow\'))) {
echo $banimal; }
else
echo "No";
?>