Skip to content

Instantly share code, notes, and snippets.

@jason-cleaveland
Last active December 12, 2021 18:48
Show Gist options
  • Save jason-cleaveland/22b6b376850d6ba0144af4a50cb6810b to your computer and use it in GitHub Desktop.
Save jason-cleaveland/22b6b376850d6ba0144af4a50cb6810b to your computer and use it in GitHub Desktop.
Groundhogg Purchases Tab Demo
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden.
}
/*
* Register the purchases tab
*
*/
function rtp_customer_tab( $tabs ) {
$tabs['purchases'] = 'Purchases';
return $tabs;
}
add_filter( 'groundhogg/admin/contact/record/tabs_after', 'rtp_customer_tab' );
/*
* Display the purchases tab
*
*/
function rtp_customer_tab_content( $contact ) {
?>
<div style="max-width: 800px">
<h2>Purchases</h2>
<p class="description">A list of all purchases sorted by date.</p>
<table class="wp-list-table widefat fixed striped table-view-list events">
<thead>
<tr>
<th>Date</th>
<th>Product</th>
<th>Base Price</th>
<th>Discount</th>
<th>Sale Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>2021-01-01</td>
<td>Best Roadtrip Planning Apps</td>
<td>$54.00</td>
<td>68%</td>
<td>$17.00</td>
</tr>
</tbody>
</table>
</div>
<?php
return;
}
add_action( 'groundhogg/admin/contact/record/tab/purchases', 'rtp_customer_tab_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment