应用过滤器后,过帐类型订单不起作用

时间:2018-07-19 10:32:49

标签: php jquery wordpress custom-post-type

我正在使用此帖子类型订单plugin 与Ajax拖放到Wp-admin自定义帖子列表中一样,它工作得很好,但是当我们按类别过滤帖子时,无法重新排序。例如,它适用于

https://example.com/wp-admin/edit.php?post_type=schools

但如果我们在帖子列表中应用类别过滤器,则无法使用。

https://example.com/wp-admin/edit.php?s&post_status=all&post_type=schools&action=-1&m=0&schools_category=nyc&seo_filter&readability_filter&filter_action=Filter&paged=1&action2=-1

在以上两种情况下,它都应该可以进行相同的拖放自定义重新排序帖子。

任何人,请您能帮助我。或其他任何建议。

这是插件文件中的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){

                                                              }
                                                        });

                                                    }
                                                });


});

1 个答案:

答案 0 :(得分:1)

此插件可与所有过滤器一起使用,您可以在自定义帖子类型中使用自定义的拖放重新排序顺序。 https://wordpress.org/plugins/intuitive-custom-post-order/

相关问题