2015-09-30 50 views
0

我已经创建了一个插件,其中有一个单独的页面的订单列表..它看起来像WooCommerce的订单列表页面,但是。我无法获得该订单的评论,所以我添加了我的自定义帖子类型到wc_order_types之后,没有列出订单..它显示一个空表。 ?自定义订单列表页面与WooCommerce

add_filter('wc_order_types',array($this,'add_wc_order_types'),10,3); 
public function add_wc_order_types($order_types,$type){ 
    $order_types[] = WC_QD_PT; 
    return $order_types; 
} 

回答

1

我解决了问题,只是通过增加一个条件,如果在我的钩子函数 function add_wc_order_types($order_types,$type){ $order_type = $order_types; if('' == $type){ $order_type[] = WC_QD_PT; } return $order_type; }

1

apply_filters('wc_order_types', $order_types, $for);是默认wc_filters带您已要求3这里add_filter('wc_order_types',array($this,'add_wc_order_types'),10,3);并再次提供2

访问http://docs.woothemes.com/wc-apidocs/source-function-wc_get_order_types.html#149它可以帮助你做到这两个参数。

+0

感谢。但它不起作用。我在WP_List_Table –

+0

中使用vardump'have_posts()'获得'false'值,那么我猜'wc_order_types'由于某些原因无法检索'$ order_types',你应该尝试找出。 –

+0

我的钩子返回值。我检查了。它 –

相关问题