- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的 WordPress 安装中使用了 GD 星级评级插件,用于创建 2 组不同的评级(帖子和视频)。 (我找不到任何其他支持此功能的插件)。
我在一个 wp_query 中使用了以下参数来显示评分最高的视频列表,并且工作正常。
$args=array(
'post_type' => 'youtube_videos',
'post_status' => 'publish',
'posts_per_page' => 10,
'gdsr_sort' => 'rating',
'gdsr_multi' => 3
);
在同一页面上,我试图显示评分最高的帖子列表,并在 wp_query 中使用以下参数,但它不起作用。
$args=array(
'posts_per_page' => 4,
'post_type' => 'post',
'gdsr_sort' => 'rating',
'gdsr_multi' => 0
);
我发现问题在于“gdsr_multi”变量中的值传递,如果我从评分最高的视频中删除此变量,则代码的第二部分工作正常。
我无法同时运行两者,请问有什么建议吗?
<小时/>对于 GD 星级评分插件的 gdsr_multi
变量文档说:
最佳答案
您应该在开始新查询之前重置查询。 wp_reset_query();
将销毁自定义循环上使用的先前查询。应在循环之后调用此函数,以确保条件标记按预期工作。例如:
<?php
query_posts( 'post_parent=5' );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?><a href="<?php the_permalink() ?>"><?php the_title() ?></a><br /><?php
endwhile;
endif;
wp_reset_query();
//your second query will be here.
?>
关于WordPress : Issue with wp_query and gd star rating plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15344390/
我在帖子过滤器表单中添加了一个文本字段,并使用 s= 参数来进行搜索。但是如何只在帖子的标题中搜索(而不是在内容中)? HTML: Filter PHP: $args = array(
有什么方法可以在 WP_Query 中按文件名 对附件进行排序吗? 例如,在参数中: $args = array( 'post_type' => 'attachment', 'post
我需要你的帮助,我是 wp_query 的新手而且我不知道如何显示所选类别中为该类别撰写帖子的所有作者。所以这意味着我继续我的页面,例如:爱好然后我想显示该类别的所有帖子以及撰写此帖子的作者。 我搜索
我正在尝试使用 WP_Query 编写一个新的查询函数目的。 我创建了一个新的模板文件并输入以下内容: $query_args = array( 'post_t
我想从两种帖子类型中获得结果, 1)发布,只显示“业务”踢球者 2)本地新闻,显示所有踢球者 我到目前为止: $args=array( 'cat' => $my_category_id, 'post_
我正在手动获取 woocommerce 产品。 问题是我在产品上有一个自定义字段,即 _locations。一个产品可以属于多个位置,所以我在 wp-admin 的产品添加表单中提供了一个多选列表。
我正在尝试使用 WP_Query 创建包含 meta_query 元素和 tax_query 元素的查询。更关键的是,我不想找到满足两个条件(和 AND 子句)的结果,我想找到满足其中一个或另一个的条
我设置了一个功能 slider ,用于绘制标记为“功能”的帖子 $my_query = new WP_Query(array( 'showposts' => 3, 'tag' => 'fea
对 WordPress 中的 wp-query 功能有疑问。我的问题是,是否可以仅显示以某些字符开头的页面。例如,我想显示以字符 A 开头的所有页面,并且该页面是某个父页面的子页面。我知道如何显示带有
我想从两种自定义帖子类型获取结果,并按自定义元(开始事件的日期)对它们进行排序。 这段代码: $warsztaty_q = new WP_Query(array( 'post_type' =>
此代码获取链接到 term_name 的所有类型的 10 个帖子; global $wp_query; query_posts( array( "taxonomy_name" => "ter
我正在尝试使用 wp_query 查询 WordPress 中的帖子。我想将帖子放入类别中并使用 has_tag 进行查询。我尝试使用 $args = array (
我正在尝试向 WordPress 模板添加自定义查询并包含分页,但我的分页没有出现,例如,我正在尝试将其添加到 page.php。 我有以下标记,当放置在类别模板(如 category.php)中时,
我正在使用 WP_Query 来查询我的自定义帖子类型帖子。此自定义帖子类型具有父页面和子页面。我正在尝试拉出第一个父页面。我该怎么做? 最佳答案 $parent_only_query = new W
我正在尝试使用 WP_Query 和一些参数在 wordpress 中检索一些页面: $args = array( 'post_type' => 'posttype', 'posts_pe
我正在尝试使用 wp_query 查询 WordPress 中的帖子。我想将帖子放入类别中并使用 has_tag 进行查询。我尝试使用 $args = array (
我正在尝试向 WordPress 模板添加自定义查询并包含分页,但我的分页没有出现,例如,我正在尝试将其添加到 page.php。 我有以下标记,当放置在类别模板(如 category.php)中时,
我在开发我的全新博客模板(在 WordPress 上)时遇到了困难。我有以下查询/php 代码: echo ''; $args = array( 'post_type' => 'era', 'post
我已经搜索了好几天了,试图让现代部落的 WordPress 事件日历按我需要的方式工作。 我在数据库中有数百个订单截止日期和交货日期,每个日期间隔大约 5-10 周。我想要实现的是一个列表,我可以在其
目前,我对 WP_query 无法给出正确结果感到非常困惑。 我想做的是根据数组中存储的值得出结果。 请参阅下面的代码; // Array contents: // $size_array = Arr
我是一名优秀的程序员,十分优秀!