2015-09-30 49 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

我的鉤子返回值。我檢查了。它 –

相關問題