Fires inside the contact record tab navigation. Use this to add custom tabs to the contact edit screen.
do_action( 'groundhogg/contact/record/nav/inside', $contact );
You will receive the Contact object.
Example
add_action( 'groundhogg/contact/record/nav/inside', 'my_extension_add_contact_tab' );
add_action( 'groundhogg/admin/contact/record/tab/my_extension_orders', 'my_extension_render_orders_tab' );
/**
* Add a custom tab to the contact record navigation.
*
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_extension_add_contact_tab( $contact ) {
$url = add_query_arg( 'tab', 'my_extension_orders' );
echo 'Orders';
}
/**
* Render the content for the custom tab.
*
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_extension_render_orders_tab( $contact ) {
$orders = my_extension_get_orders( $contact->get_email() );
if ( empty( $orders ) ) {
echo 'No orders found.';
return;
}
echo '';
foreach ( $orders as $order ) {
echo '#' . esc_html( $order->id ) . ' β ' . esc_html( $order->total ) . '';
}
echo '';
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
