我正在使用in_category(array)
在循环内部,检测帖子是否被归类为讨论类别(或有几个slug中的一个)。这件衣服穿起来很漂亮single.php
但在内部使用时,似乎没有进行评估page.php
?
FWIW,这是我的代码:
<?php if ( in_category( array( \'Discussions\', \'discussion\', \'discussion-article\' ) )) :?>
<p id="discussions-prepended"><em>This is an article from our Discussions series - read more in the <a href="/discussions">Discussions section</a>.</em></p>
<?php endif;?>
在borked页面上。php实例,我也尝试过<?php elseif:?>
<p>This post does not meet the category criteria.</p>
<?php endif;?>
但这也不能让我相信代码没有被评估。在这两种情况下,此代码段都是在<?php the_content(\'\'); ?>
(the_content()
单件。php);它只是无法评估或显示在页面中。php。故意行为还是我做错了?