Wordpress查询Magento/WHMCS返回错误的结果



我试图在一个站点的页脚列中显示WordPress中特定类别的帖子。它工作得很好,除非页脚显示在集成在WHMCS或Magento的页面上。出于某种原因,在这些应用程序中的这些页面上,它仍然显示博客文章列,但不是返回指定类别中最近的X #篇文章,而是返回最近的X #篇文章。

例如,下面是一个独立的Wordpress博客专栏,从一个特定的类别中提取:

http://www.thinkshovels.com/includes/latest_work.php

这正是我们希望在整个网站中显示的内容,但是如果您访问http://www.thinkshovels.com/service/,您可以看到中间列没有显示该信息。

下面是查询wordpress的代码:

定义("WP_USE_THEMES",假);要求("/home/铲子/public_html/博客/wp-load.php ');

$qarray = array('cat' => '5', 'posts_per_page' => 4);
query_posts($qarray);

while (have_posts()): the_post();

$args = array('post_type' => 'attachment', 'numberposts' => -1,' postrongtatus ' =>空,"post_parent"=>> ID)后美元;

我不确定我是否在这里做错了什么,或者是否有更好的方法来解决这个问题,但似乎WHMCS和Magento打破了这些查询。

任何提示/建议感谢!谢谢。

get_posts代替query_posts

根据Developer.WordPress.com的文章,您应该避免使用query_posts。

最新更新