php - 应用过滤器时,帖子类型订单不起作用
问题描述
我正在使用这个 Post Type Order插件 它在 Wp-admin 自定义帖子列表中作为 ajax 拖放东西效果很好,但当我们按类别过滤帖子时不会重新排序。例如,它适用于
https://example.com/wp-admin/edit.php?post_type=schools
但如果我们在帖子列表中应用类别过滤器,则不起作用。
对于上述两种情况,它应该可以使用相同的拖放自定义重新排序帖子。
你能帮我吗,任何人。或任何其他建议。
这是插件文件中的Js代码
var getUrlParameter = function getUrlParameter(sParam)
{
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
jQuery(document).ready(function()
{
jQuery('table.posts #the-list').sortable({
'items': 'tr',
'axis': 'y',
'update' : function(e, ui) {
var post_type = jQuery('input[name="post_type"]').val();
var order = jQuery('#the-list').sortable('serialize');
var paged = getUrlParameter('paged');
if(typeof paged === 'undefined')
paged = 1;
var queryString = { "action": "update-custom-type-order-archive", "post_type" : post_type, "order" : order ,"paged": paged, "archive_sort_nonce" : CPTO.archive_sort_nonce};
//send the data through ajax
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: queryString,
cache: false,
dataType: "html",
success: function(data){
},
error: function(html){
}
});
}
});
});
解决方案
该插件适用于所有过滤器,您可以在自定义帖子类型中使用自定义拖放重新排序帖子。 https://wordpress.org/plugins/intuitive-custom-post-order/
推荐阅读
- microservices - 在微服务世界中协调流程
- amazon-web-services - 从 Glue 控制台将 input_file_path 参数提供给粘合
- sql-server - 尝试通过 knex 连接到 Mssql 服务器
- ssms - 有什么方法可以强制 SSMS 识别一些基本的 HTML 代码或自动替换它?
- javascript - Internet Explorer 11 中的 JavaScript 正则表达式
- php - 在变量中获取值之后的所有内容
- javascript - 对于 Chrome 中的每个键,keyPressed 函数只会触发一次
- java - 邮件认证失败
- php - 条带支付模块上的 SSL 证书错误
- python - OpenCV中圆圈周围的锯齿状边缘 - Python