条件if语句/ is_page在WordPress 3.0中不起作用

时间:2010-09-02 21:48:22

标签: wordpress wordpress-theming

我已经尝试了很多变化,我知道当我放入is_home时这是有效的,即使这不是我想要实现的但是它会在每个页面上显示....如果我尝试其他类似is_front_page或者像我在下面的例子中所拥有的那样,这是我实际上想要实现的,然后它没有(工作!)。有人可以帮忙吗?

<?php if (is_page('about')) { ?>
    <div id="testimonial-block" class="sidebar-block clearfix">
    <h4>Testomonials</h4>
    <p>"I feel so much more motivated and in control of my life. The coaching has given me the time to think about what I really wanted to achieve and how I can make it happen. I have been completely blown away by how much I have enjoyed coaching with Becky and embraced the concept across my whole life."<br />
    <small>Caroline Rowe, <br />
    Communications Manager</small></p>
    </div>
    <?php } ?>

2 个答案:

答案 0 :(得分:1)

修好了!它把它放在<?php wp_reset_query(); ?>

答案 1 :(得分:0)

代码看起来很好。

is_page()函数执行区分大小写的字符串比较(我相信)。

检查字母大小写..并查看它是否有效。