Dashboard_Widgets
Admin Columns Class.
Namespace: WebberZone\Top_Ten\Admin
Since: 3.3.0
Source: includes/admin/class-dashboard-widgets.php line 21
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 28
public function __construct( );
dashboard_glance_items()
Add Top 10 views from the current hour to the At a Glance widget.
Since: 4.3.0
Line: 43
public function dashboard_glance_items( $items ): string[];
| Type | Name | Description |
|---|---|---|
string[] | $items | Array of extra At a Glance items. |
Returns: string[] — Modified array of extra At a Glance items.
dashboard_glance_styles()
Add a better icon for Top 10 At a Glance items.
Since: 4.3.0
Line: 84
public function dashboard_glance_styles( );
get_current_hour_views() static
Get the number of views recorded in the current hour.
Top 10 stores daily counts in hourly buckets, so this returns the current hour bucket rather than a rolling 60-minute window.
Since: 4.3.0
Line: 105
static public function get_current_hour_views( ): int;
Returns: int — Number of views in the current hour.
get_views_for_period() static
Get the number of views recorded in a period.
Since: 4.3.0
Line: 118
static public function get_views_for_period( $from_hour, $to_hour ): int;
| Type | Name | Description |
|---|---|---|
string | $from_hour | Start hour in Y-m-d H format. |
string | $to_hour | End hour in Y-m-d H format. |
Returns: int — Number of views in the period.
get_glance_item() static
Build a Top 10 At a Glance item.
Since: 4.3.0
Line: 144
static public function get_glance_item( $views, $label, $url ): string;
| Type | Name | Description |
|---|---|---|
int | $views | Views. |
string | $label | Label with a %s placeholder for the formatted count. |
string | $url | Link URL. |
Returns: string — At a Glance item markup.
wp_dashboard_setup() static
Function to add the widgets to the Dashboard.
Since: 3.3.0
Line: 157
static public function wp_dashboard_setup( );
wp_network_dashboard_setup() static
Function to add the widgets to the Network Dashboard.
Since: 4.2.0
Line: 201
static public function wp_network_dashboard_setup( );
pop_display() static
Create the Dashboard Widget and content of the Popular pages
Since: 3.3.0
Line: 252
static public function pop_display( $daily = ..., $page = ..., $limit = ..., $widget = ..., $network = ... ): string;
| Type | Name | Description |
|---|---|---|
bool | $daily | Switch for Custom Period or Overall popular posts. |
int | $page | Which page of the lists are on. |
int | $limit | Maximum number of posts per page. |
bool | $widget | Is this a WordPress widget. |
bool | $network | Whether to show network-wide posts. |
Returns: string — Formatted list of popular posts
popular_posts_widget() static
Widget for Popular Posts.
Since: 3.3.0
Line: 362
static public function popular_posts_widget( );
popular_posts_widget_daily() static
Widget for Custom Period Popular Posts.
Since: 3.3.0
Line: 372
static public function popular_posts_widget_daily( );
network_popular_posts_widget() static
Widget for Network Popular Posts.
Since: 4.2.0
Line: 381
static public function network_popular_posts_widget( );
network_popular_posts_widget_daily() static
Widget for Network Custom Period Popular Posts.
Since: 4.2.0
Line: 390
static public function network_popular_posts_widget_daily( );
views_over_time_widget() static
Widget for Views Overview (mini chart).
Since: 4.2.0
Line: 399
static public function views_over_time_widget( );