【发布时间】:2018-12-12 16:27:12
【问题描述】:
我有以下内容,当有子帖子时,它正确显示了响应(“对这篇文章的 1 条响应”)。当没有子帖子时,我需要它来删除带有 h3 标签“对此作品的回应”的 div。它在前一个 div 中显示为一个段落。有什么想法吗?
我尝试在 have_posts() = 0) 处添加 ifelse 语句。到目前为止,这还没有奏效。
<div>
<?php if ($count = $child_query->have_posts() > 0)
{ ?>
<div class="responses-to-piece lemonde"><h3>
<?php echo $count; 'Responses to this piece';}
?> Responses to this piece</h3></div>
【问题讨论】:
标签: php wordpress loops if-statement