duancao1951 2015-06-16 14:56
浏览 72
已采纳

Wordpress has_posts在静态页面主页中不起作用

I've got a problem with the function have_posts in my static page home... I would like to have a static page for my home but when I use have_posts in a loop, I don't have any posts but I have pages...

I don't understand what is going wrong...

Have you got an idea to fix that ?

Thanks

  • 写回答

1条回答 默认 最新

  • dongmian8108 2015-06-16 15:00
    关注

    The have_posts() on a static home page is to show the static home page.

    Description
    This function checks to see if the current WordPress query has any results to loop over. This is a boolean function, meaning it returns either TRUE or FALSE.

    So it checks if the query returns anything (pages,posts,custom content types).

    The have_posts() will return TRUE with 1 post(page) in it, the page you set as your static homepage.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀