Home › Forums › Calendar Products › Events Calendar PRO › Date comparison
- This topic has 3 replies, 2 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 15, 2014 at 11:20 am #396438
aling
ParticipantHello 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
July 15, 2014 at 3:28 pm #398441aling
ParticipantAlright, so here is what I wrote and it seemed to work but am no sure if this is correct way of writing it or not.
$todayDate = date(“Y-m-d H:i:s”);
$eventDate=get_post_meta($id,’_EventStartDate’, “Y-m-d H:i:s”);
if ((strtolower($linkr)==’yes’) && ($eventDate >= $todayDate))July 15, 2014 at 4:43 pm #398856aling
ParticipantForgot to close this out.
July 7, 2015 at 6:31 am #983405Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Date comparison’ is closed to new replies.
