Skip to content

Instantly share code, notes, and snippets.

@wpcrmsystem
Created August 30, 2016 20:00
Show Gist options
  • Save wpcrmsystem/a74ef748cb532b108a340f4c026c4e3d to your computer and use it in GitHub Desktop.
Save wpcrmsystem/a74ef748cb532b108a340f4c026c4e3d to your computer and use it in GitHub Desktop.
WP-CRM System Dashboard Boxes
/* Action hooks that add the default boxes.
-----------------------------------------*/
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_create_new_box', 1 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_extensions_box', 2 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_categories_box', 3 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_settings_box', 4 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_projects_box', 5 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_tasks_box', 6 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_opportunities_box', 7 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_campaigns_box', 8 );
/* Add your own box to the dashboard
-----------------------------------*/
add_action( 'wpcrm_system_custom_dashboard_boxes', 'my_dashboard_box' );
function my_dashboard_box() {
echo '<div class="wpcrm-dashboard">';
//your content goes here
echo '</div>';
}
/* Remove the existing "Your Projects" box from the dashboard.
--------------------------------------------------------------*/
add_action( 'wpcrm_system_custom_dashboard_boxes', 'remove_dashboard_projects', 1 );
function remove_dashboard_projects() {
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_projects_box', 5 );
}
/* Reorder the dashboard boxes.
-------------------------------*/
add_action( 'wpcrm_system_custom_dashboard_boxes', 'reorder_dashboard_boxes', 1 );
function reorder_dashboard_boxes() {
// remove boxes
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_create_new_box', 1 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_extensions_box', 2 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_categories_box', 3 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_settings_box', 4 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_projects_box', 5 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_tasks_box', 6 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_opportunities_box', 7 );
remove_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_campaigns_box', 8 );
// add each back with a new priority
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_projects_box', 1 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_tasks_box', 2 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_opportunities_box', 3 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_campaigns_box', 4 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_create_new_box', 5 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_extensions_box', 6 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_categories_box', 7 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_settings_box', 8 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment