WordPress 3.1 WP_Query 停止工作
升级到 3.1.. 使用 Devster 主题。幻灯片和另一个特殊的帖子查询停止工作..
这个变量最终为空..即使帖子确实存在于该类别中..
$featured_slide = new WP_Query('category_name='.$featured_cat.'&posts_per_page='.$featured_num);
有什么帮助吗? 我没有看到任何可以改变这种行为的东西。
upgraded to 3.1.. using the Devster theme. The slideshows and another special post query stopped working..
this variable ends up empty.. even tho posts do exist in that category..
$featured_slide = new WP_Query('category_name='.$featured_cat.'&posts_per_page='.$featured_num);
Any help?
I didn't see anything that would change this behavior.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚开始学习 WordPress,是一名初级 php 程序员。我正在测试 WP 的 Codex Loop 部分中给出的循环示例。我输入示例代码,只从“功能”类别中获取一篇文章,并收到一个致命错误,表明没有有效的类。我最终只是玩了一下,并将
$WP_Query
更改为$wp_query
。这给了我另一个关于空的错误。这个错误与$do_not_duplicate
行有关,所以我只是删除了这一行。不确定什么是空的,因为我的类别退出时有 2 个帖子添加到该类别。至少现在我已经删除了这一行,它似乎可以工作。对于一个新手来说这是非常令人沮丧的。我希望这有帮助。I just started learning WordPress and am a beginner php programmer. I was testing the loop examples that were given in the WP's Codex Loop section. I typed in the example code to get only one post from the "feature" category and received a fatel error that there was no valid class. I ended up just playing around with it and changed the
$WP_Query
to$wp_query
. This gave me another error about being empty. This error had something to do with the$do_not_duplicate
line, so I just deleted this one. Not sure what is empty because my category exits with 2 posts added to this category. At least it seems to be working now that I have deleted this line. It's very frustrating for a newbie. I hope this helps.