Skip to content

Instantly share code, notes, and snippets.

@wpcrmsystem
Created August 30, 2016 20:43
Show Gist options
  • Save wpcrmsystem/cd3c10ac2c9dc835ec5486a5162a4a9a to your computer and use it in GitHub Desktop.
Save wpcrmsystem/cd3c10ac2c9dc835ec5486a5162a4a9a to your computer and use it in GitHub Desktop.
Add Tab to WP-CRM System Reports
<?php
/* Add custom report tab and content
------------------------------------*/
// Add custom report's tab
add_action( 'wpcrm_system_report_tab', 'wpcrm_system_custom_report_tab', 8 );
function wpcrm_system_custom_report_tab() {
// Retrieve the active tab
global $wpcrm_reports_active_tab;
//Be sure 'my-tab-name' is the same in both places! ?>
<a class="nav-tab <?php echo $wpcrm_reports_active_tab == 'my-tab-name' ? 'nav-tab-active' : ''; ?>" href="?page=wpcrm-reports&tab=my-tab-name"><?php _e('My Tab Name', 'wp-crm-system'); ?></a>
<?php }
// Add custom report's content
add_action( 'wpcrm_system_report_content', 'wpcrm_system_report_custom_content' );
function wpcrm_system_report_custom_content() {
// Retrieve the active tab
global $wpcrm_reports_active_tab;
if ($wpcrm_reports_active_tab == 'my-tab-name') { //Be sure 'my-tab-name' matches above name ?>
<div class="wrap">
<div>
<h2>My report name</h2>
Some content here
</div>
</div>
<?php}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment