diff --git a/assets/css/dashboard.css b/assets/css/dashboard.css index 994959a6..5acc3fec 100644 --- a/assets/css/dashboard.css +++ b/assets/css/dashboard.css @@ -5,6 +5,31 @@ margin: 0; } + +#dashboard_right_now .sp-event-count a:before, +#dashboard_right_now .sp-event-count span:before, +#dashboard_right_now .sp-team-count a:before, +#dashboard_right_now .sp-team-count span:before, +#dashboard_right_now .sp-player-count a:before, +#dashboard_right_now .sp-player-count span:before { + font-family: 'sportspress'; +} + +#dashboard_right_now .sp-event-count a:before, +#dashboard_right_now .sp-event-count span:before { + content: "\f145"; +} + +#dashboard_right_now .sp-team-count a:before, +#dashboard_right_now .sp-team-count span:before { + content: "\f334"; +} + +#dashboard_right_now .sp-player-count a:before, +#dashboard_right_now .sp-player-count span:before { + content: "\f307"; +} + #sportspress_dashboard_status .sp_status_list { overflow: hidden; margin: 0; diff --git a/includes/admin/class-sp-admin-dashboard.php b/includes/admin/class-sp-admin-dashboard.php index d744be24..b4a23c5e 100644 --- a/includes/admin/class-sp-admin-dashboard.php +++ b/includes/admin/class-sp-admin-dashboard.php @@ -5,7 +5,7 @@ * @author ThemeBoy * @category Admin * @package SportsPress/Admin - * @version 0.7 + * @version 1.1 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -32,6 +32,32 @@ class SP_Admin_Dashboard { */ public function init() { wp_add_dashboard_widget( 'sportspress_dashboard_status', __( 'SportsPress', 'sportspress' ), array( $this, 'status_widget' ) ); + add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); + } + + /** + * Add links to At a Glance + */ + function glance_items( $items = array() ) { + $post_types = array( 'sp_event', 'sp_team', 'sp_player' ); + foreach ( $post_types as $type ): + if ( ! post_type_exists( $type ) ) continue; + $num_posts = wp_count_posts( $type ); + if ( $num_posts ): + $published = intval( $num_posts->publish ); + $post_type = get_post_type_object( $type ); + $text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'your_textdomain' ); + $text = sprintf( $text, number_format_i18n( $published ) ); + if ( current_user_can( $post_type->cap->edit_posts ) ): + $output = '' . $text . ''; + echo '