doumuyu0837 2013-11-11 18:33
浏览 30

一个Wordpress循环似乎正在影响另一个

I have a wordpress loop to get most popular posts at the top of my index page like this:

<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
endwhile;

and then the main loop below it to list all of the blog posts like this:

<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
endwhile;

However both loops dont seem to be working together - in the main loop that is supposed to be grabbing all of the posts - it is not and is missing the first week of posts. Why is this happening?

  • 写回答

1条回答 默认 最新

  • duan4739 2013-11-11 18:55
    关注

    You should use wp_reset_postdata() after first loop

    评论

报告相同问题?

悬赏问题

  • ¥20 关于php中URL传递GET全局变量的问题
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件