Changeset 155757
- Timestamp:
- 09/17/2009 05:03:53 PM (16 years ago)
- Location:
- recently-updated-pages
- Files:
-
- 6 added
- 2 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/recently_updated_pages.php (added)
-
tags/1.0.1/screenshot-1.jpg (added)
-
tags/1.0.1/screenshot-2.jpg (added)
-
tags/1.0.1/screenshot-3.jpg (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/recently_updated_pages.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
recently-updated-pages/trunk/readme.txt
r155443 r155757 4 4 Donate link: http://resource.bdwebwork.com/WordpressPlugins/RecentlyUpdatedPages/ 5 5 Author URI: http://ehsan.bdwebwork.com/ 6 Tags: updated, recent, page 6 Tags: updated, recent, page, post 7 7 Requires at least: 2.8 8 8 Tested up to: 2.8 9 Stable tag: 1.0. 09 Stable tag: 1.0.1 10 10 11 Purpose of this plugin is to display the list of pages on Wordpress blog those have been recently updated.11 Purpose of this plugin is to display the list of pages (and optionally posts) on Wordpress blog those have been recently updated. 12 12 13 13 == Description == 14 14 15 15 Sometimes when you update one of your pages on the Wordpress blog you would want visitors to know about those. This widget will create a sidebar 16 box with a list of pages you've recently updated. It also shows the date of the update beside the page title. 16 box with a list of pages you've recently updated. It also shows the date of the update beside the page title. 17 18 You've an option to display the Posts in the list as well. If checked (through admin panel) the list will include the Posts along with the list of Pages. 17 19 18 20 == Installation == … … 38 40 You can define it through the widget editor in the Wordpress admin panel. Specify the number and save. 39 41 42 = Will I be able to show my blog POST titles in the list? = 43 44 Yes, now you can. Check the option to include the blog Posts in the list and it will show them along with the Page list. 45 40 46 == Screenshots == 41 47 42 1. widget-on-admin.jpg 43 2. widget-on-blog.jpg 48 1. Widget as shown in Admin panel 49 2. Widget on the blog, only showing the Pages 50 3. Widget on the blog showing both Pages and Posts 44 51 45 52 == Changelog == -
recently-updated-pages/trunk/recently_updated_pages.php
r155451 r155757 4 4 * 5 5 * Plugin name: Recently Updated Pages 6 * Description: Purpose of this plugin is to display the list of pages on6 * Description: Purpose of this plugin is to display the list of pages (and optionally posts) on 7 7 * Wordpress blog those have been recently updated. 8 * Version: 1.0. 08 * Version: 1.0.1 9 9 * Plugin URI: http://resource.bdwebwork.com/WordpressPlugins/RecentlyUpdatedPages/ 10 10 * Author: Ehsanul Haque … … 41 41 $title = apply_filters('widget_title', $instance['title']); 42 42 $totalPagesToShow = (int) $instance['totalPagesToShow']; 43 $showListWithPosts = (int) $instance['showListWithPosts']; 43 44 44 45 $defaults = array ( 45 46 'title' => 'Recently Updated Pages', 46 'totalPagesToShow' => 3 47 'totalPagesToShow' => 3, 48 'showListWithPosts' => 0 47 49 ); 48 50 … … 56 58 57 59 if ($totalPagesToShow != 0) { 58 $pageList = $this->getListOfPages($totalPagesToShow );60 $pageList = $this->getListOfPages($totalPagesToShow, $showListWithPosts); 59 61 } else { 60 $pageList = $this->getListOfPages($defaults['totalPagesToShow'] );62 $pageList = $this->getListOfPages($defaults['totalPagesToShow'], $defaults['showListWithPosts']); 61 63 } 62 64 63 echo "<ul>"; 64 echo str_replace("</a>", "</a> on ", $pageList); 65 echo "</ul>"; 66 65 if (!empty($pageList)) { 66 echo "<ul>"; 67 foreach ($pageList as $obj) { 68 echo "<li class='page_item page-item-{$obj->ID}'><a href='{$obj->uri}' title='{$obj->post_title}'>{$obj->post_title}</a> on {$obj->post_modified}</li>"; 69 } 70 echo "</ul>"; 71 } 67 72 echo $after_widget; 68 73 } … … 73 78 $instance['title'] = strip_tags($new_instance['title']); 74 79 $instance['totalPagesToShow'] = strip_tags($new_instance['totalPagesToShow']); 80 $instance['showListWithPosts'] = strip_tags($new_instance['showListWithPosts']); 75 81 76 82 return $instance; … … 82 88 $defaults = array ( 83 89 'title' => 'Recently Updated Pages', 84 'totalPagesToShow' => 3 90 'totalPagesToShow' => 3, 91 'showListWithPosts' => 0 85 92 ); 86 93 … … 96 103 <input id="<?php echo $this->get_field_id('totalPagesToShow'); ?>" name="<?php echo $this->get_field_name('totalPagesToShow'); ?>" value="<?php echo $instance['totalPagesToShow']; ?>" style="width:100%;" /> 97 104 </p> 105 106 <p> 107 <label for="<?php echo $this->get_field_id('showListWithPosts'); ?>">Include blog Posts in the list:</label> 108 <input id="<?php echo $this->get_field_id('showListWithPosts'); ?>" name="<?php echo $this->get_field_name('showListWithPosts'); ?>" value="1" type="checkbox" 109 <?php 110 if ($instance['showListWithPosts'] == 1) { 111 echo " Checked"; 112 } 113 ?> 114 /> 115 </p> 98 116 <?php 99 117 } 100 118 101 // Getting the list of pages based on the option set by the user 102 function getListOfPages($totalPagesToShow) { 103 $args = array ( 104 'depth' => 0, 105 'child_of' => 0, 106 'depth' => -1, 107 'show_date' => 'modified', 108 'date_format' => 'F j, Y', 109 'sort_column' => 'post_modified', 110 'sort_order' => 'desc', 111 'title_li' => '', 112 'number' => $totalPagesToShow, 113 'echo' => 0 114 ); 115 116 return wp_list_pages($args); 119 // Getting the list of pages ( and posts) based on the option set by the user 120 function getListOfPages($totalPagesToShow, $showListWithPosts) { 121 GLOBAL $wpdb; 122 123 if ($showListWithPosts == 1) { 124 $postTypeWhere = "post_type IN ('page', 'post')"; 125 } else { 126 $postTypeWhere = "post_type = 'page'"; 127 } 128 $sql = "SELECT ID, post_title, post_modified FROM 129 {$wpdb->posts} WHERE 130 post_status = 'publish' AND 131 {$postTypeWhere} 132 ORDER BY post_modified DESC 133 LIMIT {$totalPagesToShow}"; 134 135 $list = (array) $wpdb->get_results($sql); 136 137 if (!empty($list)) { 138 foreach ($list as $key => $val) { 139 $val->uri = get_permalink($val->ID); 140 } 141 } 142 143 return $list; 117 144 } 118 145 }
Note: See TracChangeset
for help on using the changeset viewer.