Recent

Dashboard_Widgetsclass

Dashboard_Widgets

Registers the Top 10 dashboard widgets and At a Glance items.

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(  );

clear_network_dashboard_cache() static

Clear cached network dashboard widget output.

Since: 4.5.0
Line: 40

static public function clear_network_dashboard_cache(  );

dashboard_glance_items()

Add Top 10 views from the current hour to the At a Glance widget.

Since: 4.3.0
Line: 53

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: 94

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: 115

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: 128

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: 154

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: 167

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: 211

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: 262

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

Widget for Popular Posts.

Since: 3.3.0
Line: 426

static public function popular_posts_widget(  );

Widget for Custom Period Popular Posts.

Since: 3.3.0
Line: 436

static public function popular_posts_widget_daily(  );

Widget for Network Popular Posts.

Since: 4.2.0
Line: 445

static public function network_popular_posts_widget(  );

Widget for Network Custom Period Popular Posts.

Since: 4.2.0
Line: 454

static public function network_popular_posts_widget_daily(  );

views_over_time_widget() static

Widget for Views Overview (mini chart).

Since: 4.2.0
Line: 463

static public function views_over_time_widget(  );