Skip to content

Commit

Permalink
Merge pull request #186 from xyu/module-related-posts
Browse files Browse the repository at this point in the history
Remove Date Filter for Related Posts
  • Loading branch information
xyu committed Feb 8, 2014
2 parents 8638528 + f86c568 commit ec3ee41
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/related-posts/jetpack-related-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,7 @@ public function get_for_post_id( $post_id, array $args ) {
'size' => (int)$options['size'],
'post_type' => get_post_type( $post_id ),
'has_terms' => array(),
'date_range' => array(
'from' => strtotime( '-2 year' ),
'to' => time()
),
'date_range' => array(),
'exclude_post_id' => 0,
);
$args = wp_parse_args( $args, $defaults );
Expand Down Expand Up @@ -440,7 +437,7 @@ protected function _get_es_filters_from_args( $post_id, array $args ) {
}

$args['date_range'] = apply_filters( 'jetpack_relatedposts_filter_date_range', $args['date_range'], $post_id );
if ( is_array( $args['date_range'] ) ) {
if ( is_array( $args['date_range'] ) && ! empty( $args['date_range'] ) ) {
$args['date_range'] = array_map( 'intval', $args['date_range'] );
if ( !empty( $args['date_range']['from'] ) && !empty( $args['date_range']['to'] ) ) {
$filters[] = array(
Expand Down

0 comments on commit ec3ee41

Please sign in to comment.