Changeset 2586109
- Timestamp:
- 08/20/2021 05:06:39 PM (3 years ago)
- Location:
- pages
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
pages/tags/1.1.0/pages.php
r2585740 r2586109 2 2 /** 3 3 * Plugin Name: Pages 4 * Description: Quickly and easily view your pages in the dashboard.5 * Version: 1. 0.04 * Description: Quickly and easily view your pages in the dashboard. 5 * Version: 1..0 6 6 * Author: Brad Parbs 7 7 * Author URI: https://bradparbs.com/ … … 17 17 use WP_Query; 18 18 19 // Add new dashboard widget with list of draft posts. 20 add_action( 21 'wp_dashboard_setup', 22 function () { 23 wp_add_dashboard_widget( 24 'pages', 25 sprintf( 26 '<span><span class="dashicons dashicons-admin-page" style="padding-right: 10px"></span>%s</span>', 27 esc_attr__( 'Recent Pages', 'pages' ) 28 ), 29 __NAMESPACE__ . '\\dashboard_widget' 30 ); 31 } 32 ); 19 add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' ); 33 20 34 21 /** 35 * Add dashboard widget for draft posts. 22 * Add new dashboard widget with list of recently modified pages. 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( 'pages_widget_icon', 'dashicons-admin-page' ), 28 apply_filters( 'pages_widget_title', esc_attr__( 'Recent Pages', 'pages' ) ) 29 ); 30 31 wp_add_dashboard_widget( 'pages', $name, __NAMESPACE__ . '\\dashboard_widget' ); 32 } 33 34 /** 35 * Add dashboard widget for recently modified pages. 36 36 */ 37 37 function dashboard_widget() { 38 $posts = new WP_Query( 39 [ 40 'post_type' => 'page', 41 'orderby' => 'modified', 42 'post_status' => 'publish', 43 'order' => 'DESC', 44 'posts_per_page' => 25, 45 'no_found_rows' => true, 46 ] 38 $query_args = apply_filters( 'pages_widget_query_args', [ 39 'post_type' => 'page', 40 'orderby' => 'modified', 41 'post_status' => 'publish', 42 'order' => 'DESC', 43 'posts_per_page' => 25, 44 'no_found_rows' => true, 45 ] ); 46 47 $posts = new WP_Query( $query_args ); 48 $pages = get_pages_posts( $posts ); 49 50 printf( 51 '<div id="pages-posts-widget-wrapper"> 52 <div id="pages-posts-widget" class="activity-block" style="padding-top: 0;"> 53 <ul>%s</ul> 54 </div> 55 </div>', 56 display_pages_in_widget( $pages ) // phpcs:ignore 47 57 ); 58 48 59 60 61 62 63 64 65 66 67 49 68 $pages = []; 50 69 … … 53 72 $posts->the_post(); 54 73 55 $ pages[] =[74 $ [ 56 75 'ID' => get_the_ID(), 57 76 'title' => get_the_title(), 58 77 'date' => gmdate( 'F j, g:ia', get_the_time( 'U' ) ), 59 78 'preview' => get_preview_post_link(), 60 ]; 79 ] ); 80 81 if ( isset( $add_to_pages ) ) { 82 $pages[] = $add_to_pages; 83 } 61 84 } 62 85 } 63 86 64 printf( 65 '<div id="pages-widget-wrapper"> 66 <div id="pages-widget" class="activity-block" style="padding-top: 0;"> 67 <ul>%s</ul> 68 </div> 69 </div>', 70 display_pages_in_widget( $pages ) // phpcs:ignore 71 ); 87 return $pages; 72 88 } 89 73 90 /** 74 * Display draft posts in widget.91 * Display s in widget. 75 92 * 76 93 * @param array $posts Post data. -
pages/tags/1.1.0/readme.txt
r2585740 r2586109 4 4 Requires at least: 5.2 5 5 Tested up to: 5.8 6 Stable tag: 1. 0.06 Stable tag: 1..0 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.6 … … 12 12 == Description == 13 13 14 Quickly and easily view your pages in the dashboard. 14 Quickly and easily view all your recently modified pages in the dashboard. 15 16 == Availiable filters == 17 18 `pages_widget_icon` - The dashicon to use for the dashboard widget. 19 `pages_widget_title` - The title to use for the dashboard widget. 20 `pages_widget_query_args` - An array of arguments to pass to the WP_Query. 21 `pages_show_in_widget` - Will pass ID of each post, returning `false` will not add it to the dashboard widget. 22 23 == Changelog == 24 25 = 1.1.0 = 26 27 * Added more filters 28 29 = 1.0.0 = 30 31 * Initial release -
pages/trunk/pages.php
r2585740 r2586109 2 2 /** 3 3 * Plugin Name: Pages 4 * Description: Quickly and easily view your pages in the dashboard.5 * Version: 1. 0.04 * Description: Quickly and easily view your pages in the dashboard. 5 * Version: 1..0 6 6 * Author: Brad Parbs 7 7 * Author URI: https://bradparbs.com/ … … 17 17 use WP_Query; 18 18 19 // Add new dashboard widget with list of draft posts. 20 add_action( 21 'wp_dashboard_setup', 22 function () { 23 wp_add_dashboard_widget( 24 'pages', 25 sprintf( 26 '<span><span class="dashicons dashicons-admin-page" style="padding-right: 10px"></span>%s</span>', 27 esc_attr__( 'Recent Pages', 'pages' ) 28 ), 29 __NAMESPACE__ . '\\dashboard_widget' 30 ); 31 } 32 ); 19 add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' ); 33 20 34 21 /** 35 * Add dashboard widget for draft posts. 22 * Add new dashboard widget with list of recently modified pages. 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( 'pages_widget_icon', 'dashicons-admin-page' ), 28 apply_filters( 'pages_widget_title', esc_attr__( 'Recent Pages', 'pages' ) ) 29 ); 30 31 wp_add_dashboard_widget( 'pages', $name, __NAMESPACE__ . '\\dashboard_widget' ); 32 } 33 34 /** 35 * Add dashboard widget for recently modified pages. 36 36 */ 37 37 function dashboard_widget() { 38 $posts = new WP_Query( 39 [ 40 'post_type' => 'page', 41 'orderby' => 'modified', 42 'post_status' => 'publish', 43 'order' => 'DESC', 44 'posts_per_page' => 25, 45 'no_found_rows' => true, 46 ] 38 $query_args = apply_filters( 'pages_widget_query_args', [ 39 'post_type' => 'page', 40 'orderby' => 'modified', 41 'post_status' => 'publish', 42 'order' => 'DESC', 43 'posts_per_page' => 25, 44 'no_found_rows' => true, 45 ] ); 46 47 $posts = new WP_Query( $query_args ); 48 $pages = get_pages_posts( $posts ); 49 50 printf( 51 '<div id="pages-posts-widget-wrapper"> 52 <div id="pages-posts-widget" class="activity-block" style="padding-top: 0;"> 53 <ul>%s</ul> 54 </div> 55 </div>', 56 display_pages_in_widget( $pages ) // phpcs:ignore 47 57 ); 58 48 59 60 61 62 63 64 65 66 67 49 68 $pages = []; 50 69 … … 53 72 $posts->the_post(); 54 73 55 $ pages[] =[74 $ [ 56 75 'ID' => get_the_ID(), 57 76 'title' => get_the_title(), 58 77 'date' => gmdate( 'F j, g:ia', get_the_time( 'U' ) ), 59 78 'preview' => get_preview_post_link(), 60 ]; 79 ] ); 80 81 if ( isset( $add_to_pages ) ) { 82 $pages[] = $add_to_pages; 83 } 61 84 } 62 85 } 63 86 64 printf( 65 '<div id="pages-widget-wrapper"> 66 <div id="pages-widget" class="activity-block" style="padding-top: 0;"> 67 <ul>%s</ul> 68 </div> 69 </div>', 70 display_pages_in_widget( $pages ) // phpcs:ignore 71 ); 87 return $pages; 72 88 } 89 73 90 /** 74 * Display draft posts in widget.91 * Display s in widget. 75 92 * 76 93 * @param array $posts Post data. -
pages/trunk/readme.txt
r2585740 r2586109 4 4 Requires at least: 5.2 5 5 Tested up to: 5.8 6 Stable tag: 1. 0.06 Stable tag: 1..0 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.6 … … 12 12 == Description == 13 13 14 Quickly and easily view your pages in the dashboard. 14 Quickly and easily view all your recently modified pages in the dashboard. 15 16 == Availiable filters == 17 18 `pages_widget_icon` - The dashicon to use for the dashboard widget. 19 `pages_widget_title` - The title to use for the dashboard widget. 20 `pages_widget_query_args` - An array of arguments to pass to the WP_Query. 21 `pages_show_in_widget` - Will pass ID of each post, returning `false` will not add it to the dashboard widget. 22 23 == Changelog == 24 25 = 1.1.0 = 26 27 * Added more filters 28 29 = 1.0.0 = 30 31 * Initial release
Note: See TracChangeset
for help on using the changeset viewer.