-
Notifications
You must be signed in to change notification settings - Fork 0
/
widgets.php
42 lines (36 loc) · 1.19 KB
/
widgets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Add dashboard widgets
*
* @package dashboard
*/
namespace gemeindetag\dashboard;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\create_dashboard_widgets', 10, 4 );
/**
* creates dashboard widget entrypoints for js to render them
*/
function create_dashboard_widgets() {
$widgets = [
'anmeldungen-stats-widget' => 'Anmeldungen',
'workshops-stats-widget' => 'Workshop Anmeldungen',
'ausfluege-stats-widget' => 'Ausflug Anmeldungen',
'essen-stats-widget' => 'Essen Anmeldungen',
'tickets-stats-widget' => 'Anmeldungen pro Tag',
'age-stats-widget' => 'Alter der Anmeldungen',
'total-earnings-widget' => 'Einnahmen',
'anmeldungen-kinderprogramm' => 'Anmeldungen Kinderprogramm',
'countdown-timer' => 'Countdown',
'mennoconnect' => 'Mennoconnect',
];
foreach ( $widgets as $widget_slug => $widget_title ) {
wp_add_dashboard_widget(
"$widget_slug-wrapper",
$widget_title,
function() use ( $widget_slug ) {
echo sprintf( '<div id="%s" class="gemeindetag-stats-widget">Loading...</div>', esc_attr( $widget_slug ) );
}
);
}
};