Title: Contribution
Last modified: August 21, 2016

---

# Contribution

 *  Resolved [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * (@ajberasategui)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/contribution-1/)
 * Hey Flourish,
 * I’m writing here as I dind’t find any other way to contact you.
 * Your plugin is great. I’ve extended it with a few lines of code to support “posts
   max age to include”. If you want I can send you it, just contact me.
 * Regards,
    Agus
 * [http://wordpress.org/plugins/fp-news-ticker/](http://wordpress.org/plugins/fp-news-ticker/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [OGC](https://wordpress.org/support/users/umyob/)
 * (@umyob)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/contribution-1/#post-4097852)
 * Would you please post the code here? I think it would be very useful.
 *  Thread Starter [ajberasategui](https://wordpress.org/support/users/ajberasategui/)
 * (@ajberasategui)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/contribution-1/#post-4097853)
 * Sure!
 * 1. Add to Widget form method:
    At the very beginning, where vars are read, `$
   max_age = $instance['max_age'];` and in the html form:
 *     ```
       <p class="fp_label">
         <label for="<?php echo $this->get_field_id('max_age'); ?>">Max Age:
           <input class="custom" id="<?php echo $this->get_field_id('max_age'); ?>" name="<?php echo $this->get_field_name('max_age'); ?>" type="text" value="<?php echo attribute_escape($max_age); ?>" />
         </label>
       </p>
       ```
   
 * 2. Add to Widget update method:
    `$instance['max_age'] = $new_instance['max_age'];`
 * 3. Replace in Widget widget method:
    `query_posts( 'cat='.$category.'&showposts
   ='.$limit );` with
 *     ```
       function filter_post_time( $where = '' ) {
       		global $max_age;
       		if ( '' != $max_age )
       			$where .= " AND DATE_SUB(NOW(), INTERVAL ". $max_age ." HOUR) <= post_date";
       		return $where;
       	}
   
       	$GLOBALS['max_age'] = $max_age;
       	add_filter( 'posts_where', 'filter_post_time' );
       	query_posts( 'cat='.$category.'&showposts='.$limit );
       	remove_filter( 'posts_where', 'filter_post_time' );
       ```
   
 * that is, before the widget method posts loop.
    And add at the begining of this
   method, where vars are set, `$max_age = empty($instance['limit']) ? '' : $instance['
   max_age'];`
 * Hope you find it useful!
 * Agus
 *  [OGC](https://wordpress.org/support/users/umyob/)
 * (@umyob)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/contribution-1/#post-4097861)
 * thank you

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Contribution’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/fp-news-ticker_909092.svg)
 * [FP News Ticker](https://wordpress.org/plugins/fp-news-ticker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fp-news-ticker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fp-news-ticker/)
 * [Active Topics](https://wordpress.org/support/plugin/fp-news-ticker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fp-news-ticker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fp-news-ticker/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [OGC](https://wordpress.org/support/users/umyob/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/contribution-1/#post-4097861)
 * Status: resolved