- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
上下文:使用带有 jigoshop 插件的 Wordpress
我正在使用 wp_list_categories 带来运作良好的产品类别并带来所需的列表。唯一的问题是类别的排序。我使用了几个 orderby 选项(名称、ID、slug),但列表顺序仍然相同,如下所示:
工具和画笔卸妆液和妆前乳粉末嘴唇荧光笔基础眼睛遮瑕膏古铜色脸红
jigoshop 小部件具有以下代码:
$args = array(
'orderby' => 'name',
'show_count' => $count,
'hierarchical' => $is_hierarchial,
'taxonomy' => 'product_cat',
'title_li' => null,
);
wp_list_categories(apply_filters('widget_product_categories_args', $args));
我将通过添加过滤器来替换它:
add_filter('widget_product_categories_args','myFun');
function myFun($out){
.......
.......
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 0,
'hide_empty' => 0,
'child_of' => $topMostParent,
'hierarchical' => 1,
'title_li' => '',
'current_category' => $cur_cat,
'taxonomy' => $taxonomyName,
);
return $args;
}
我也尝试停用其他插件,但对结果没有影响。请帮忙。谢谢。
最佳答案
很有可能,
在某个地方,另一个过滤器正在改变这些参数。
它们的执行顺序:
get_categories_taxonomy
get_terms_args
get_terms
get_terms_orderby
<-- 最有可能?list_terms_exclusions
get_terms_fields
terms_clauses
get_terms
(再次)get_terms
(再次)wp_list_categories
这些分为 3 个主要功能(可能影响结果的功能)
wp_list_categories
get_categories
get_terms
我建议从 get_terms_orderby
过滤器开始。
如果这不起作用,我会尝试使用函数 get_terms
这样您至少会知道它是否在哪个级别出错。
希望这对您有所帮助,让我知道 ;)
关于wordpress:wp_list_categories order by 根本不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13652393/
我目前正在使用以下脚本在无序列表中输出我所有的 wordpress 类别。如何获得带有额外标记的输出? 例如: Category 1 › Category 2 › 代
我需要为 wp_list_categories 编写一个自定义函数,这样它们就不是显示分层链接列表,而是一个复选框列表,父项显示为 h3 标签。 最终输出看起来像http://jsfiddle.net
我正在使用 WordPress。 有多个类别及其子类别。在一般页面中,我显示所有一级类别。这是我的代码: $args = array( 'type' => 'product-items',
下面的脚本创建网站中的类别列表(不包括“未分类”中的类别)。 如果可能,我想对其进行修改,使其仅列出顶级类别(没有子类别)... 我认为“深度”=1 参数可以解决问题,但事实并非如此。它列出了所有类别
我只想显示当前帖子页面的类别名称和链接。例如,我有一个帖子可以说“test123”,我已经将帖子与 2 个类别“ab”、“bc”链接起来。但是我有 5 个不同的类别。因此,当用户转到“test123”
上下文:使用带有 jigoshop 插件的 Wordpress 我正在使用 wp_list_categories 带来运作良好的产品类别并带来所需的列表。唯一的问题是类别的排序。我使用了几个 orde
我正在尝试删除/替换 WordPress 使用的类别元素上的 title 属性。我使用的是 WordPress 2.9.1,代码如下: Manufacturers
1.用分类做为导航拦 <?php wp_list_categories('depth=2&title_li=0&orderby=name&show_coun
我已经使用 wp_list_categories 来创建类别列表并将$ args设置为如下所示,以将类别“current-cat”添加到当前类别项目中,但一切正常,但是当我单击“所有类别”时,由于菜单
我在使用 Style 显示我的 wp_list_categories 时遇到问题。我已经在使用 args 等,但这似乎对解决问题没有帮助。 我想为单篇文章显示相同的子类别。 这里是我的代码: term
我有一个 jsfiddle.net/vanduzled/AgAwK/结果是 wp_list_categories 的输出: 所以我在 wordpress 中有一个带有子类别的类别列表,我希望它显示在我
好的,我有类别和子类别。 类别: 本田 -思域 -雅阁 丰田 -佳美利 -花冠 日产 -千里马 -反之亦然 现在我只想使用 wp-list-categories 随机显示其中的 5 个 Sub_Cat
我正在尝试从 wp_list_categories 的最后一个链接中删除最后一个分隔符(通常是 标记,但我将其更改为“//”)。 基本上我想要这个: 类别 1//类别 2//类别 3// 看起来像这
我是一名优秀的程序员,十分优秀!