我想知道如何让 #tag-container 仅在有标签时显示。我该怎么做呢?我认为有一些 if 和 else 语句,但我不知道如何正确编写它......
<div class="tag-container">
<p><?php the_tags(); ?></p>
</div>
最佳答案
<?php
if( get_the_tags() ){
echo '<div class="tag-container"><p>';
the_tags();
echo '</p></div>';
}
关于php - 当没有标签时如何隐藏标签容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17681223/