Created
October 18, 2016 21:58
-
-
Save GeoffEW/f9de188d60f3a6f9e93cb050db7f7c0a to your computer and use it in GitHub Desktop.
Adds past event possibilities to the tribe_events shortcode
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 function tribe_past_events_shortcode( $atts ) { | |
if ( ! class_exists( 'Tribe__Events__Pro__Shortcodes__Tribe_Events' ) ) return ''; | |
add_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' ); | |
$shortcode = new Tribe__Events__Pro__Shortcodes__Tribe_Events( $atts ); | |
return $shortcode->output(); | |
} | |
function tribe_past_events_shortcode_modify_query( $query ) { | |
$query->set( 'tribe_is_past', true ); | |
remove_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' ); | |
} | |
add_shortcode( 'tribe_past_events', 'tribe_past_events_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
folks could do
[tribe_past_events view="list"]
obviously, we'd be trusting them not to perform madness like
[tribe_past_events view="month"]
probably has shortcomings but may also be a reasonable start point (in advance of full-on support being rolled into
[tribe_events]
itself)