This repository was archived by the owner on Nov 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (44 loc) · 2.02 KB
/
index.php
File metadata and controls
52 lines (44 loc) · 2.02 KB
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
43
44
45
46
47
48
49
50
51
52
<?php
/*
Plugin Name: Add Admin and Scheduled Posts widgets in Admin screen
License: GPL
Version: 1.0.2
Plugin URI: http://thecellarroom.uk
Author: ChelseaStats
Author URI: http://thecellarroom.uk
Copyright (c) 2015 HESA
Description: Shows all pending and scheduled posts (from all post types) in admin dashboard widgets
*/
defined( 'ABSPATH' ) or die();
###################################################################################
if(!class_exists('tcr_wp_widgets')):
$tcr_wp_widgets = new tcr_wp_widgets();
endif;
class tcr_wp_widgets {
function _construct() {
add_action('wp_dashboard_setup', array($this, 'wp_cfc_add_dashboard_widgets'));
}
function wp_cfc_pending_post_widget_function() {
global $wpdb;
$result = $wpdb->get_results("select * from ".$wpdb->prefix."posts where post_status in ('Pending') AND post_type !='' ORDER BY post_date ASC ");
echo '<div class="activity-block one">';
foreach($result as $sc_post) {
echo '<ul><li><a href="'.get_edit_post_link($sc_post->ID).'">'.$sc_post->post_title.'</a></li></ul>';
}
echo "</div>";
}
function wp_cfc_scheduled_post_widget_function() {
global $wpdb;
$result = $wpdb->get_results("select * from ".$wpdb->prefix."posts where post_status in ('Future') AND post_type !='' ORDER BY post_date ASC ");
echo '<div class="activity-block two">';
foreach($result as $sc_post) {
echo '<ul><li><span>'.get_date_from_gmt($sc_post->post_date_gmt, $format = 'Y-m-d H:i').' <strong>:</strong> </span>
<a href="'.get_edit_post_link($sc_post->ID).'">'.$sc_post->post_title.'</a></li></ul>';
}
echo "</div>";
}
function wp_cfc_add_dashboard_widgets() {
wp_add_dashboard_widget( 'wp_cfc_dashboard_widget_one', 'Pending Activity' , array($this , 'wp_cfc_pending_post_widget_function') );
wp_add_dashboard_widget( 'wp_cfc_dashboard_widget_two', 'Scheduled Activity' , array($this , 'wp_cfc_scheduled_post_widget_function') );
}
}