如果一个变量不为空,我想显示一些HTML代码,否则我想什么也不显示。
我尝试过这段代码,但它没有起作用:
<?php
$web = the_field('website');
if (isset($web)) {
?>
<span class="field-label">Website: </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a>
<?php
} else {
echo "Niente";
}
?>