超链接无法正确显示

时间:2017-04-14 12:39:06

标签: php wordpress hyperlink woocommerce

我有表格栏"个人资料"需要输出超链接,特别是购买产品的客户的个人资料链接。

更新

它是" 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'),
        ) ); 

我尝试过:在$new_row->user_link我尝试添加print

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

1 个答案:

答案 0 :(得分: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>');