Hi Kells,
Hold on let me get my thinking cap on. Ok, it’s on. Here we go… First create the column like so:
/**
* Display a custom transaction column label
*
* @description: Adds a custom column to the transactions page; IMPROTANT: RENAME THIS FUNCTION TO SOMETHING CUSTOM TO YOUR SITE; you can rename the column to whatever data you want to appear within
* @return array
*/
function give_my_custom_tranactions_column( $columns ) {
$columns['my_column'] = __( 'My Column', 'sometextdomain' );
return $columns;
}
add_filter( 'give_payments_table_columns', 'give_my_custom_tranactions_column' );
Then, output your custom field data into the column like so:
/**
* Custom Transaction Column Data
*
* @description: Display data within your custom column
*
* @param $value
* @param $payment_id
* @param $column_name
*
* @return mixed
*/
function my_payment_column_data( $value, $payment_id, $column_name ) {
if ( $column_name == 'my_column' ) {
//output any custom data here
echo 'Hello World';
}
return $value;
}
add_filter( 'give_payments_table_column', 'my_payment_column_data', 10, 3 );
Take notice of the functions descriptions. Specifically, renamne the functions so if this is more widely used in the future you don’t run into any fatal errors.
Please review and let me know if you have anymore questions! Oh and… thanks for using Give!