AI助手支持GPT4.0
Surprisingly, WordPress does not provide a mechanism for sorting taxonomies by a custom defined order.
令人惊讶的是,WordPress没有提供按自定义定义顺序对分类法进行排序的机制。
Taxonomies can only be sorted by name or id.
分类法只能按名称或ID排序。
Custom Taxonomy Sort allows the average user a mechanism to define and display terms in a specified order.
自定义分类排序允许普通用户使用一种机制来按指定顺序定义和显示术语。
After installing Custom Taxonomy Sort, each taxonomy term will have the ability to have a “tax-order” value associated with it.
安装“自定义分类法排序”后,每个分类法术语将具有与之关联的“税单”值。
This order is specified by doing the following:
通过执行以下操作来指定此顺序: p>
By default, the order will be ascending, meaning it will sort from low to high (e.g., 1, 2, 3).
默认情况下,顺序将升序,这意味着它将从低到高排序(例如1、2、3)。
These values can be added on the Add Taxonomy screen, the Edit Taxonomy screen, or through the Quick Edit panel.
这些值可以在“添加分类法”屏幕,“编辑分类法”屏幕上或通过“快速编辑”面板添加。 li>
ol>
Custom Taxonomy Sort automatically applies the sort order to all instances in which the terms are displayed.
自定义分类法排序自动将排序顺序应用于所有显示术语的实例。
All you need to do is define that order.
您所需要做的就是定义该顺序。 p>
In addition to automatically sorting the terms, Custom Taxonomy Sort allows developers to override the automatic sort to offer finer control over how terms are displayed in different parts of WordPress.
除了自动对术语进行排序外,自定义分类排序还使开发人员可以覆盖自动排序,以更好地控制术语在WordPress不同部分中的显示方式。
Manual mode can be started by changing “Automatic Sort” to “Off” in the Custom Taxonomy Sort Settings page (wp-admin/options-general.php?page=custom-taxonomy-sort-settings).
可以通过在“自定义分类分类设置”页面(wp-admin / options-general.php?page = custom-taxonomy-sort-settings)中将“自动分类”更改为“关”来启动手动模式。
Once “Automatic Sort” is switched to “Off”, the terms will no longer be sorted automatically by the custom order.
一旦将“自动排序”切换为“关闭”,则条款将不再按自定义顺序自动排序。
Instead, the custom sort order can be envoked with a new parameter for the “orderby” argument.
而是可以使用“ orderby”参数的新参数来调用自定义排序顺序。
Custom Taxonomy Sort allows you to use the following argument to access a custom sorted list of terms using “get_terms”
自定义分类排序允许您使用以下参数使用“ get_terms”访问自定义排序的术语列表 p>
<?php get_terms('orderby = custom_sort'); ?>?> code> pre>Voila! Voila!Now, your terms will only be sorted by the specified order in the places that you want it sorted in this order.现在,您的条款将仅按指定顺序在您希望其按此顺序排序的位置进行排序。All other instances of displaying terms will revert to WordPress’ default of sorting the terms by name.显示条款的所有其他实例将恢复为WordPress默认的按名称对条款进行排序的方式。Additionally, you can specifically have the terms sort in ascending ('ASC'; default; eg, 1, 2, 3) or descending ('DESC'; eg, 3, 2, 1) order by adding the “order” argument.此外,通过添加“ order”参数,可以专门使术语以升序('ASC';默认;例如1、2、3)或降序('DESC';例如3、2、1)排序。 p> <?php get_terms('orderby = custom_sort&order = ASC'); ?>?><?php get_terms('orderby = custom_sort&order = DESC'); ?>?> code> pre>Acknowledgements致谢 h4>Thanks to Jacob M Goldman for his excellent Simple Term Meta plugin, which made programming the term感谢Jacob M Goldman出色的 Simple Term Meta插件,该术语使对术语进行编程meta quite simple.元相当简单。 li>Thanks to hydrowire for pointing out a bug感谢Hydrowire 指出一个错误 a > fixed in 1.1.1>已在1.1.1中修复 li>Thanks to “Mosey” for pointing out a bug with a situation in which order did not work for a custom taxonomy感谢“ Mosey”指出了一种错误,该错误中的顺序不适用于自定义分类法 li>Thanks to DUCK__BOY1981 for pointing out a bug where the column values where overridden inappropriately感谢DUCK__BOY1981指出一个错误,其中该列值被不适当地覆盖 li>Thanks to @martindj for pointing out a bug where the column value returned incorrectly感谢@martindj指出了列值返回错误的错误 li> ul>
<?php get_terms('orderby = custom_sort'); ?>?>
?>
?>
code> pre>
Voila!
Voila!
Now, your terms will only be sorted by the specified order in the places that you want it sorted in this order.
现在,您的条款将仅按指定顺序在您希望其按此顺序排序的位置进行排序。
All other instances of displaying terms will revert to WordPress’ default of sorting the terms by name.
显示条款的所有其他实例将恢复为WordPress默认的按名称对条款进行排序的方式。
Additionally, you can specifically have the terms sort in ascending ('ASC'; default; eg, 1, 2, 3) or descending ('DESC'; eg, 3, 2, 1) order by adding the “order” argument.
此外,通过添加“ order”参数,可以专门使术语以升序('ASC';默认;例如1、2、3)或降序('DESC';例如3、2、1)排序。
p>
<?php get_terms('orderby = custom_sort&order = ASC'); ?>?><?php get_terms('orderby = custom_sort&order = DESC'); ?>?> code> pre>Acknowledgements致谢 h4>Thanks to Jacob M Goldman for his excellent Simple Term Meta plugin, which made programming the term感谢Jacob M Goldman出色的 Simple Term Meta插件,该术语使对术语进行编程meta quite simple.元相当简单。 li>Thanks to hydrowire for pointing out a bug感谢Hydrowire 指出一个错误 a > fixed in 1.1.1>已在1.1.1中修复 li>Thanks to “Mosey” for pointing out a bug with a situation in which order did not work for a custom taxonomy感谢“ Mosey”指出了一种错误,该错误中的顺序不适用于自定义分类法 li>Thanks to DUCK__BOY1981 for pointing out a bug where the column values where overridden inappropriately感谢DUCK__BOY1981指出一个错误,其中该列值被不适当地覆盖 li>Thanks to @martindj for pointing out a bug where the column value returned incorrectly感谢@martindj指出了列值返回错误的错误 li> ul>
<?php get_terms('orderby = custom_sort&order = ASC'); ?>?><?php get_terms('orderby = custom_sort&order = DESC'); ?>?>
<?php get_terms('orderby = custom_sort&order = DESC');
meta quite simple.
元相当简单。
li>
> fixed in 1.1.1
>已在1.1.1中修复 li>
ul>
custom_taxonomy_sort
/wp-content/plugins/
custom_taxonomy_sort code>文件夹上载至 / wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>
/ wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>
原文出处:http://www.sanshu.cn/a/9807.html
群主管理都是支付大佬