【发布时间】:2016-10-20 11:45:09
【问题描述】:
我在 apache 环境中有一个 wordpress 站点(由其他人构建),该站点已移至我们的 windows 服务器,我有一个奇怪的问题,即一个简单的 PhP/WP 循环两次输出相同的结果,即使有数据库中查询的一个结果。作为一名 MVC/NET 开发人员,我不确定下一步该去哪里,因为我无法调试(单步执行)代码。
<?php
if (have_posts()): while (have_posts()) : the_post();
$query = new WP_query('pagename=about');
$query->the_post();
/* Page Content */
echo '<h2 class="heading">';
the_title();
echo '</h2>';
echo '<div class="content">';
the_content();
echo '</div>';
?>
<?php endwhile; ?>
<?php endif; ?>
关于可能导致此问题的原因或我如何设置循环限制的任何想法?
【问题讨论】:
标签: php mysql wordpress templating