Hello everyone!
So our company is currently use Events Calendar pro. Right now for the custom fields section, I have an option to display the event on the homepage or not. If yes is selected, it gets generated/added to the plugin we use to display an event carousel called bxSlider.
Currently, whenever an event ends, I have to manually go in and select no for “Display on homepage”. I was wondering if anyone knew of a way to make it so that it would automatically fall off once the event date & time passes?
This is the query that we currently have. I was thinking that I would have to add in the “if(strtolower($linkr)==’yes’)” something along the lines of “and if the tribe_get_end_date > today” but I don’t know how to write that part.
<?php $query_str = “SELECT distinct wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = ‘_EventStartDate’ AND wposts.post_type = ‘tribe_events’ ORDER BY wpostmeta.meta_value ASC “;
$posts = $wpdb->get_results( $query_str );
foreach($posts as $post){
setup_postdata($post);
$id=get_the_ID();
$linkr=get_post_meta($id,’_ecp_custom_3′,true);
if (strtolower($linkr)==’yes’) {
$link=get_permalink($id);
echo “”;
}
}
?>
Website: http://www.lightgroup.com