WordPress 3.1 WP_Query 停止工作

发布于 2024-10-19 06:35:19 字数 248 浏览 1 评论 0原文

升级到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

厌倦 2024-10-26 06:35:19

我刚刚开始学习 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文