Wordpress 最近的帖子没有显示在主页上,但显示在其他页面上

Wordpress recent posts not showing on homepage, but shows up on other pages

从我的 footer.php 上的自定义 post 类型中提取 3 个最新的 post,但是常见问题解答列表没有出现在我的主页上,它出现在其他页面上但是,使用相同的 footer.php 文件。
主页:http://tinyurl.com/p922sc8


其他页面:http://tinyurl.com/ond88ll & http://tinyurl.com/pd5qndd


这是我的循环:

<?php  if (have_posts()) : ?>
    <?php query_posts('post_type=faq&posts_per_page=3&order=ASC'); while ( have_posts() ) : the_post(); ?>
        <li><a href="<?php echo home_url() . "/faq"; ?>#answer<?php the_id() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;?>
<?php endif; ?>
<?php wp_reset_query(); ?>


知道为什么吗?

首先,query_posts 已弃用。请改用 WP_Query。请记住,您应该先确定您的查询,然后再使用循环。

<?php $q = new WP_Query(array('post_type' => 'faq', 'posts_per_page' => '3', 'orderBy' => 'title', 'order' => 'ASC')) ?>
<?php if($q->have_posts()): while($q->have_posts()) : $q->the_post(); ?>
    <li><a href="<?php echo home_url("/faq"); ?>#answer<?php the_id() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>