2017-04-14 130 views
0

我有需要輸出超鏈接的表列「配置文件」,特別是購買產品的客戶的配置文件鏈接。超鏈接無法正確顯示

更新

這是有問題了 「USER_LINK」,這裏是它的現在是:

$new_row->ID   = $order->get_order_number(); 
       $new_row->order_number = $order->get_order_number(); 
       $new_row->customer  = $customer_details; 
       $new_row->products  = $products_html; 
       $new_row->total   = $total_text; 
       $new_row->status  = $shipped; 
       $new_row->user_link = print '<p><a class="author-link" href="'. $order->user_link .'">'. __('Click here to view user profile') . '</a><p>'; 
       $new_row->order_date = date_i18n(wc_date_format(), strtotime($order->order_date)) . '<br /><strong>' . ucfirst($order->get_status()) . '</strong>'; 
       $new_row->row_actions = $row_actions; 
       $new_row->action_after = $this->order_details_template($_order) . $this->order_note_template($order->get_order_number()) . $this->tracking_number_template($order->get_order_number(), get_current_user_id()); 

       do_action('wcv_orders_add_new_row', $new_row); 

       $rows[] = $new_row; 

表列:

public function table_columns() { 

     $columns = apply_filters('wcv_order_table_columns', array( 
        'ID'   => __('ID',   'wcvendors-pro'), 
        'order_number' => __('Purchase ID',  'wcvendors-pro'), 
        'customer'  => __('Customer',  'wcvendors-pro'), 
        'products'  => __('Product)',  'wcvendors-pro'), 
        'total'   => __('Total',   'wcvendors-pro'), 
        'order_date' => __('Sale Date',  'wcvendors-pro'), 
        'user_link'  => __('Profile', 'wcvendors-pro'), 
     )); 

我試了一下:在我試過加print

$new_row->user_link = print '<p><a class="author-link" href="'. $order->user_link .'">'. __('Click here to view user profile') . '</a><p>'; 
+0

輸出什麼,你得到,如果你'的var_dump($ USER_LINK)'? – Juned

+0

嗨,我不知道該把它放在哪裏? get_post_meta($ order-> id,'_user_link',true); ? –

+0

將var_dump放在echo之前並刷新頁面。它會顯示變量的內容以及是否有輸出內容。 – Juned

回答

1

更改此:

$new_row->user_link = print '<p><a class="author-link" href="'. $order->user_link .'">'. __('Click here to view user profile') . '</a><p>'; 

到:

print('<p><a class="author-link" href="'. $order->user_link .'">Click here to view user profile</a><p>'); 
+0

好的,所以我這樣做了,數字「1」已從配置文件列中消失,但「單擊此處查看用戶配置文件」仍然在整個表格之外.. –

+0

這是不同的問題的原始和更多的格式問題。如果一個鏈接現在已經輸出並且可以正常工作,那麼這個問題就會被解答 – Juned

+0

同意!謝謝!將打開一個新的問題:)再次感謝。 –