gpt4 book ai didi

javascript - 更改 wpDataTables 中的 iDisplayLength

转载 作者:行者123 更新时间:2023-11-30 00:25:28 25 4
gpt4 key购买 nike

关于 my site我正在使用插件 wpDataTables (基于 jQuery 数据表)。例如,当我在搜索字段中键入 HB 时,我得到了 10 个结果(价格),但我只需要 6

所以我想将 iDisplayLength 从 10 更改为 6 但它没有按照@datatables.net 的建议工作

这里有一些 Front-end callbacks via JS .是否可以通过这些前端回调实现?

最佳答案

Using filters and actions 上观看视频wpdatatables 的作者解释了如何几乎完全按照您的意愿去做。

基本上,您需要将以下代码添加到 WordPress 主题的 functions.php 中。

请注意,此代码将影响您网站上的所有表格。如果你想定位一个特定的表,那么只有当 $table_id 等于你的表 ID 时,你才需要更改 iDisplayLength 参数。

function mytheme_wpdatatables_filter_table_description($object, $table_id){
$object->dataTableParams->iDisplayLength = 6;

return $object;
}
add_filter('wpdatatables_filter_table_description', 'mytheme_wpdatatables_filter_table_description', 10, 2);

关于javascript - 更改 wpDataTables 中的 iDisplayLength,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31598220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com