Created
November 12, 2012 18:27
-
-
Save jo-snips/4060995 to your computer and use it in GitHub Desktop.
The Events Calendar: Customize RSS Date Range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'pre_get_posts', 'show_one_year_of_events' ); | |
| function show_one_year_of_events( $query ) { | |
| if ( $query->is_feed && empty( $query->query_vars['suppress_filters'] ) ) { | |
| $query->set('meta_query', array( | |
| 'relation' => 'OR', | |
| array( | |
| 'key' => '_EventStartDate', | |
| 'value' => array( | |
| date('Y-m-d H:i:s', strtotime('now')), | |
| date('Y-m-d H:i:s', strtotime('+1 weeks'))), | |
| 'compare' => 'BETWEEN', | |
| 'type' => 'DATETIME' | |
| ), | |
| array( | |
| 'key' => '_EventEndDate', | |
| 'value' => array( | |
| date('Y-m-d H:i:s', strtotime('now')), | |
| date('Y-m-d H:i:s', strtotime('+1 weeks'))), | |
| 'compare' => 'BETWEEN', | |
| 'type' => 'DATETIME' | |
| ) | |
| ) | |
| ); | |
| } | |
| return $query; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment