Adding custom contact table columns
This code is used to add the custom column inside Groundhogg's contact table.
<?php add_action( 'groundhogg_contact_columns', 'add_my_custom_column' ); function add_my_custom_column( $cols ){ $cols[ 'my_col' ] = __( 'My Column' ); return $cols; } add_action( 'groundhogg_contacts_custom_column', 'show_my_custom_column', 10, 2 ); /** * @param $contact \Groundhogg\Contact * @param $column_name string */ function show_my_custom_column( $contact, $column_name ) { if ( $column_name === 'my_col' ){ print_r( '<a href="%s">%s</a>', add_query_arg( [ 'page' => 'gh_contacts', 'meta_key' => 'lead_attribution', 'meta_value' => urlencode( $contact->get_meta( 'lead_attribution' )) ], admin_url( 'admin.php' ) ), esc_html( $contact->get_meta( 'lead_attribution' ) ) ])); } } ?>