Changeset 2586107
- Timestamp:
- 08/20/2021 05:06:34 PM (3 years ago)
- Location:
- schedules
- Files:
-
- 2 deleted
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
schedules/tags/1.1.0/readme.txt
r2547681 r2586107 1 1 === Schedules === 2 Contributors: bradparbs 2 Contributors: bradparbs 3 3 Tags: posts, schedule, scheduled, content, calendar, widget, dashboard 4 4 Requires at least: 5.2 5 Tested up to: 5. 7.26 Stable tag: 1. 0.05 Tested up to: 5. 6 Stable tag: 1..0 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.6 … … 13 13 14 14 Quickly and easily view all your scheduled posts. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 -
schedules/tags/1.1.0/schedules.php
r2547681 r2586107 3 3 * Plugin Name: Schedules 4 4 * Description: Quickly and easily view all your scheduled posts. 5 * Version: 1. 0.05 * Version: 1..0 6 6 * Author: Brad Parbs 7 7 * Author URI: https://bradparbs.com/ … … 17 17 use WP_Query; 18 18 19 defined( 'ABSPATH' ) || die();19 ); 20 20 21 // Add new dashboard widget with list of scheduled posts. 22 add_action( 23 'wp_dashboard_setup', 24 function () { 25 wp_add_dashboard_widget( 'scheduled', '<span><span class="dashicons dashicons-clock" style="padding-right: 10px"></span>' . esc_attr__( 'Scheduled' ) . '</span>', __NAMESPACE__ . '\\dashboard_widget' ); 26 } 27 ); 21 /** 22 * Add new dashboard widget with list of scheduled posts. 23 */ 24 function add_dashboard_widget() { 25 $name = sprintf( 26 '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>', 27 apply_filters( 'schedules_widget_icon', 'dashicons-clock' ), 28 apply_filters( 'schedules_widget_title', esc_attr__( 'Scheduled', 'schedules' ) ) 29 ); 30 31 wp_add_dashboard_widget( 'schedules', $name, __NAMESPACE__ . '\\dashboard_widget' ); 32 } 28 33 29 34 /** … … 31 36 */ 32 37 function dashboard_widget() { 33 $posts = new \WP_Query( 34 [ 35 'post_type' => get_post_types(), 36 'post_status' => 'future', 37 'orderby' => 'date', 38 'order' => 'ASC', 39 'posts_per_page' => 25, 40 'no_found_rows' => true, 41 ] 42 ); 38 $post_types = apply_filters( 'schedules_post_types_to_show', get_post_types() ); 39 $query_args = apply_filters( 'schedules_widget_query_args', [ 40 'post_type' => $post_types, 41 'post_status' => 'future', 42 'orderby' => 'date', 43 'order' => 'ASC', 44 'posts_per_page' => 25, 45 'no_found_rows' => true, 46 ] ); 43 47 44 $scheduled = []; 45 46 if ( $posts->have_posts() ) { 47 while ( $posts->have_posts() ) { 48 $posts->the_post(); 49 50 $scheduled[] = [ 51 'ID' => get_the_ID(), 52 'title' => get_the_title(), 53 'date' => gmdate( 'F j, g:ia', get_the_time( 'U' ) ), 54 'preview' => get_preview_post_link(), 55 ]; 56 } 57 } 48 $posts = new WP_Query( $query_args ); 49 $scheduled = get_scheduled_posts( $posts ); 58 50 59 51 printf( … … 66 58 ); 67 59 } 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 68 91 /** 69 92 * Display scheduled posts in widget. -
schedules/trunk/readme.txt
r2547681 r2586107 1 1 === Schedules === 2 Contributors: bradparbs 2 Contributors: bradparbs 3 3 Tags: posts, schedule, scheduled, content, calendar, widget, dashboard 4 4 Requires at least: 5.2 5 Tested up to: 5. 7.26 Stable tag: 1. 0.05 Tested up to: 5. 6 Stable tag: 1..0 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.6 … … 13 13 14 14 Quickly and easily view all your scheduled posts. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 -
schedules/trunk/schedules.php
r2547681 r2586107 3 3 * Plugin Name: Schedules 4 4 * Description: Quickly and easily view all your scheduled posts. 5 * Version: 1. 0.05 * Version: 1..0 6 6 * Author: Brad Parbs 7 7 * Author URI: https://bradparbs.com/ … … 17 17 use WP_Query; 18 18 19 defined( 'ABSPATH' ) || die();19 ); 20 20 21 // Add new dashboard widget with list of scheduled posts. 22 add_action( 23 'wp_dashboard_setup', 24 function () { 25 wp_add_dashboard_widget( 'scheduled', '<span><span class="dashicons dashicons-clock" style="padding-right: 10px"></span>' . esc_attr__( 'Scheduled' ) . '</span>', __NAMESPACE__ . '\\dashboard_widget' ); 26 } 27 ); 21 /** 22 * Add new dashboard widget with list of scheduled posts. 23 */ 24 function add_dashboard_widget() { 25 $name = sprintf( 26 '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>', 27 apply_filters( 'schedules_widget_icon', 'dashicons-clock' ), 28 apply_filters( 'schedules_widget_title', esc_attr__( 'Scheduled', 'schedules' ) ) 29 ); 30 31 wp_add_dashboard_widget( 'schedules', $name, __NAMESPACE__ . '\\dashboard_widget' ); 32 } 28 33 29 34 /** … … 31 36 */ 32 37 function dashboard_widget() { 33 $posts = new \WP_Query( 34 [ 35 'post_type' => get_post_types(), 36 'post_status' => 'future', 37 'orderby' => 'date', 38 'order' => 'ASC', 39 'posts_per_page' => 25, 40 'no_found_rows' => true, 41 ] 42 ); 38 $post_types = apply_filters( 'schedules_post_types_to_show', get_post_types() ); 39 $query_args = apply_filters( 'schedules_widget_query_args', [ 40 'post_type' => $post_types, 41 'post_status' => 'future', 42 'orderby' => 'date', 43 'order' => 'ASC', 44 'posts_per_page' => 25, 45 'no_found_rows' => true, 46 ] ); 43 47 44 $scheduled = []; 45 46 if ( $posts->have_posts() ) { 47 while ( $posts->have_posts() ) { 48 $posts->the_post(); 49 50 $scheduled[] = [ 51 'ID' => get_the_ID(), 52 'title' => get_the_title(), 53 'date' => gmdate( 'F j, g:ia', get_the_time( 'U' ) ), 54 'preview' => get_preview_post_link(), 55 ]; 56 } 57 } 48 $posts = new WP_Query( $query_args ); 49 $scheduled = get_scheduled_posts( $posts ); 58 50 59 51 printf( … … 66 58 ); 67 59 } 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 68 91 /** 69 92 * Display scheduled posts in widget.
Note: See TracChangeset
for help on using the changeset viewer.