Changeset 553315
- Timestamp:
- 06/05/2012 07:47:57 AM (14 years ago)
- Location:
- random-post-for-widget/trunk
- Files:
-
- 3 edited
-
random_post_widget.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
screenshot-1.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
random-post-for-widget/trunk/random_post_widget.php
r547837 r553315 3 3 Plugin Name: Random Post for Widget 4 4 Plugin URI: http://www.shashionline.in/random-post-widget-wordpress/ 5 Description: Random Post for Widget will show random post on your sidebar 6 Author URI: http://www.shashionline.in/ about-me/5 Description: Random Post for Widget will show random post on your sidebar. You can exclude certain posts by ID. 6 Author URI: http://www.shashionline.in/ 7 7 Author: Shashidhar Kumar 8 8 Donate link: http://www.shashionline.in/ 9 Tags: plugin, posts, random, random post, random posts, simple plugin, widget, Wordpress9 Tags: plugin, posts, random, random post, random posts, simple plugin, widget, Wordpress 10 10 Requires at least: 3.0 11 11 Tested up to: 3.3.2 12 12 Stable tag: trunk 13 Version: 1.014 License: GPLv2 or later13 Version: 2.0 14 License: GPLv2 or later 15 15 License URI: http://www.gnu.org/licenses/gpl-2.0.html 16 16 */ … … 30 30 $title = $instance['title']; 31 31 $noofpost = $instance['noofpost']; 32 $hidepost = $instance['hidepost']; 32 33 ?> 33 34 <p> 34 35 <label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label> 35 36 <label for="<?php echo $this->get_field_id('noofpost'); ?>">No. of Post: <input class="widefat" id="<?php echo $this->get_field_id('noofpost'); ?>" name="<?php echo $this->get_field_name('noofpost'); ?>" type="text" value="<?php echo attribute_escape($noofpost); ?>" /></label> 37 <label for="<?php echo $this->get_field_id('hidepost'); ?>">Exclude Posts by ID(comma seperated): <input class="widefat" id="<?php echo $this->get_field_id('hidepost'); ?>" name="<?php echo $this->get_field_name('hidepost'); ?>" type="text" value="<?php echo attribute_escape($hidepost); ?>" /></label> 36 38 </p> 37 39 <?php … … 43 45 $instance['title'] = $new_instance['title']; 44 46 $instance['noofpost'] = $new_instance['noofpost']; 47 $instance['hidepost'] = $new_instance['hidepost']; 45 48 return $instance; 46 49 } … … 53 56 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 54 57 $noofpost = $instance['noofpost']; 58 $hidepost = $instance['hidepost']; 55 59 56 60 if (!empty($title)) … … 65 69 } 66 70 // WIDGET CODE GOES HERE 67 //query_posts('posts_per_page=2&orderby=rand'); 68 query_posts('posts_per_page='.$noofpost.'&orderby=rand'); 71 $arr = explode(",",$hidepost); 72 $args = array( 73 'post__not_in' => $arr, 74 'post_type' => 'post', 75 'posts_per_page' => $noofpost, 76 'orderby' => rand 77 ); 78 query_posts( $args ); 69 79 if (have_posts()) : 70 80 echo "<ul>"; 71 81 while (have_posts()) : the_post(); 72 82 echo "<li><a href='".get_permalink()."'>".get_the_title(); 73 //echo the_post_thumbnail(array(220,200));74 83 echo "</a></li>"; 75 84 -
random-post-for-widget/trunk/readme.txt
r547837 r553315 3 3 Plugin Name: Random Post for Widget 4 4 Plugin URI: http://www.shashionline.in/random-post-widget-wordpress/ 5 Author URI: http://www.shashionline.in/ about-me/5 Author URI: http://www.shashionline.in/ 6 6 Author: Shashidhar Kumar 7 7 Donate link: http://www.shashionline.in/ … … 9 9 Requires at least: 3.0 10 10 Tested up to: 3.3.2 11 Stable tag: trunk12 Version: 1.011 Stable tag: 1.1 12 Version: 2.0 13 13 License: GPLv2 or later 14 14 License URI: http://www.gnu.org/licenses/gpl-2.0.html 15 15 16 This simple plugin is a widget that displays a list of random posts on your sidebar. 16 This simple plugin is a widget that displays a list of random posts on your sidebar. You can exclude certain posts by ID. 17 17 18 18 == Description == 19 19 20 This simple plugin is a widget that displays a list of random posts on your sidebar. 20 This simple plugin is a widget that displays a list of random posts on your sidebar. You can exclude certain posts by ID. 21 21 22 22 == Installation ==
Note: See TracChangeset
for help on using the changeset viewer.