Last active
July 21, 2019 21:44
-
-
Save joshfeck/d68b3c6da61c92ce92c4f77a958a20de to your computer and use it in GitHub Desktop.
This file contains 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 | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
function custom_posts_where_sql_for_only_expired() { | |
return ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end < "' . current_time( 'mysql', TRUE ) . '" | |
AND post_status = "publish"'; | |
} | |
add_action( 'loop_start', 'my_custom_event_view_only_expired' ); | |
function my_custom_event_view_only_expired() { | |
if ( is_page( 'past-events-page' ) ) { // swap in the page slug here for to match the page where you display the list | |
add_filter( 'posts_where', 'custom_posts_where_sql_for_only_expired' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment