Yes, a monthly graph of financial performance and another showing accounts receivable. That would be fantastic.
Oh, and adding buttons for “New quote” and “New Invoice” would be great, too. Perhaps even “Edit last invoice” ?
I was debating whether or not to share this code snippet since I paid to have it written but someone else shared a snippet that really helped me out so this feels like paying it forward. This will add the widgets from the Sliced Invoices > Reports to the WordPress Dashboard as a custom widget if you add it to your functions.php
/*Sliced Invoices – Dashboard Widget*/
function enqueue_scripts_only_on_dashboard() {
// Get the current screen
$screen = get_current_screen();
// Check if the current screen is the dashboard
if ($screen && $screen->id === ‘dashboard’) {
// Enqueue your scripts here
$SlicedAdmin = new Sliced_Admin(‘sliced-invoices’, SLICED_VERSION);
wp_enqueue_script( ‘sliced-invoices-chart’, WP_PLUGIN_URL . ‘/sliced-invoices/admin/js/Chart.min.js’, array( ‘jquery’ ), SLICED_VERSION, false );
3 Comments. Leave new
Yes, a monthly graph of financial performance and another showing accounts receivable. That would be fantastic.
Oh, and adding buttons for “New quote” and “New Invoice” would be great, too. Perhaps even “Edit last invoice” ?
All the best,
Dax
It’s baffling that there are no primary admin dashboard widgets for this.
I was debating whether or not to share this code snippet since I paid to have it written but someone else shared a snippet that really helped me out so this feels like paying it forward. This will add the widgets from the Sliced Invoices > Reports to the WordPress Dashboard as a custom widget if you add it to your functions.php
/*Sliced Invoices – Dashboard Widget*/
function enqueue_scripts_only_on_dashboard() {
// Get the current screen
$screen = get_current_screen();
// Check if the current screen is the dashboard
if ($screen && $screen->id === ‘dashboard’) {
// Enqueue your scripts here
$SlicedAdmin = new Sliced_Admin(‘sliced-invoices’, SLICED_VERSION);
wp_enqueue_script( ‘sliced-invoices-chart’, WP_PLUGIN_URL . ‘/sliced-invoices/admin/js/Chart.min.js’, array( ‘jquery’ ), SLICED_VERSION, false );
$SlicedAdmin->enqueue_styles();
$SlicedAdmin->enqueue_scripts();
}
}
add_action(‘admin_enqueue_scripts’, ‘enqueue_scripts_only_on_dashboard’);
function custom_dashboard_invoice_report($slicedReports) {
echo ”;
$slicedReports->invoice_report();
echo ”;
}
function custom_dashboard_quote_report($slicedReports) {
echo ”;
$slicedReports->quote_report();
echo ”;
}
function custom_dashboard_quotes_and_invoices($slicedReports) {
echo ”;
$slicedReports->invoice_quote_chart();
echo ”;
}
function custom_dashboard_current_quote_statuses($slicedReports) {
echo ”;
$slicedReports->quote_status();
echo ”;
}
function custom_dashboard_current_invoice_statuses($slicedReports) {
echo ”;
$slicedReports->invoice_status();
echo ”;
}
function add_custom_dashboard_widget() {
$slicedReports = new Sliced_Reports();
wp_add_dashboard_widget(‘custom_dashboard_invoice_report’, ‘Invoice Report’, function() use ($slicedReports) {
custom_dashboard_invoice_report($slicedReports);
});
wp_add_dashboard_widget(‘custom_dashboard_quote_report’, ‘Quote Report’, function() use ($slicedReports) {
custom_dashboard_quote_report($slicedReports);
});
wp_add_dashboard_widget(‘custom_dashboard_quotes_and_invoices’, ‘Quotes and Invoices’, function() use ($slicedReports) {
custom_dashboard_quotes_and_invoices($slicedReports);
});
wp_add_dashboard_widget(‘custom_dashboard_current_quote_statuses’, ‘Current Quote Statuses’, function() use ($slicedReports) {
custom_dashboard_current_quote_statuses($slicedReports);
});
wp_add_dashboard_widget(‘custom_dashboard_current_invoice_statuses’, ‘Current Invoice Statuses’, function() use ($slicedReports) {
custom_dashboard_current_invoice_statuses($slicedReports);
});
}
add_action(‘wp_dashboard_setup’, ‘add_custom_dashboard_widget’);
add_filter(“admin_body_class”, function($classes) {
$current_screen = get_current_screen();
if($current_screen->base == “dashboard”) {
$classes .= ” sliced sliced-invoices_page_sliced_reports “;
}
return $classes;
});