Plugin Directory

Changeset 553315


Ignore:
Timestamp:
06/05/2012 07:47:57 AM (14 years ago)
Author:
shashidharkumar
Message:
 
Location:
random-post-for-widget/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • random-post-for-widget/trunk/random_post_widget.php

    r547837 r553315  
    33Plugin Name:        Random Post for Widget
    44Plugin 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/
     5Description:        Random Post for Widget will show random post on your sidebar. You can exclude certain posts by ID.
     6Author URI:         http://www.shashionline.in/
    77Author:             Shashidhar Kumar
    88Donate link:        http://www.shashionline.in/
    9 Tags:               plugin, posts, random, random post, random posts, simple plugin, widget, Wordpress
     9Tags:               plugin, posts, random, random post, random posts, simple plugin, widget, Wordpress
    1010Requires at least:  3.0
    1111Tested up to:       3.3.2
    1212Stable tag:         trunk
    13 Version:            1.0
    14 License:            GPLv2 or later
     13Version:            2.0
     14License:            GPLv2 or later
    1515License URI:        http://www.gnu.org/licenses/gpl-2.0.html
    1616*/
     
    3030    $title = $instance['title'];
    3131    $noofpost = $instance['noofpost'];
     32    $hidepost = $instance['hidepost'];
    3233?>
    3334  <p>
    3435  <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>
    3536  <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>
    3638  </p>
    3739<?php
     
    4345    $instance['title'] = $new_instance['title'];
    4446    $instance['noofpost'] = $new_instance['noofpost'];
     47    $instance['hidepost'] = $new_instance['hidepost'];
    4548    return $instance;
    4649  }
     
    5356    $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
    5457    $noofpost = $instance['noofpost'];
     58    $hidepost = $instance['hidepost'];
    5559 
    5660    if (!empty($title))
     
    6569        }
    6670    // 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 );
    6979    if (have_posts()) :
    7080        echo "<ul>";
    7181        while (have_posts()) : the_post();
    7282            echo "<li><a href='".get_permalink()."'>".get_the_title();
    73             //echo the_post_thumbnail(array(220,200));
    7483            echo "</a></li>";   
    7584     
  • random-post-for-widget/trunk/readme.txt

    r547837 r553315  
    33Plugin Name:        Random Post for Widget
    44Plugin URI:         http://www.shashionline.in/random-post-widget-wordpress/
    5 Author URI:         http://www.shashionline.in/about-me/
     5Author URI:         http://www.shashionline.in/
    66Author:             Shashidhar Kumar
    77Donate link:        http://www.shashionline.in/
     
    99Requires at least:  3.0
    1010Tested up to:       3.3.2
    11 Stable tag:         trunk
    12 Version:            1.0
     11Stable tag:         1.1
     12Version:            2.0
    1313License:        GPLv2 or later
    1414License URI:        http://www.gnu.org/licenses/gpl-2.0.html
    1515
    16 This simple plugin is a widget that displays a list of random posts on your sidebar.
     16This simple plugin is a widget that displays a list of random posts on your sidebar. You can exclude certain posts by ID.
    1717
    1818== Description ==
    1919
    20 This simple plugin is a widget that displays a list of random posts on your sidebar.
     20This simple plugin is a widget that displays a list of random posts on your sidebar. You can exclude certain posts by ID.
    2121
    2222== Installation ==
Note: See TracChangeset for help on using the changeset viewer.