prepare('SELECT sum(Commission), sum(Confirmed) FROM '.$wpdb->prefix.'ap_transaction WHERE SubId = %d AND TransactionStatus <> "Cancelled"', $id); $arr_earnings = $wpdb->get_row($sql, ARRAY_N); $total_earning = number_format($arr_earnings[0], 2, ',', '.'); $confirmed_earning = number_format($arr_earnings[1], 2, ',', '.'); $output = $total_earning . ' € ('.$confirmed_earning.' €)'; //$output = $arr_earnings[0]; echo $output; } } static public function makeEarningsColumnSortable( $columns ) { $columns['earnings'] = 'earnings'; return $columns; } //todo: fix sort, this is not working because earnings is not in post data table static public function handleSortEarningsColumn( $vars ) { if ( isset( $vars['orderby'] ) && $vars['orderby'] == 'earnings' ) { $vars = array_merge( $vars, array( 'meta_key' => 'earnings', 'orderby' => 'meta_value_num' ) ); } return $vars; } } ?>