Home › Forums › Calendar Products › Events Calendar PRO › Event Calendar Pro "has_event" ?
- This topic has 6 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
December 15, 2011 at 8:47 am #12344
murphy1976
MemberGood Morning Tribal Council,
I would like to add a small div box on the top of my site that checks whether or not TODAY has any events. If (has_event == true), then display styled div and list the events that are occuring today and their links. If (has_event == false), div does not display at all.Is there a current global check that I can do outside any loop just to see if today has any events?
Thank you in advance.
December 15, 2011 at 7:04 pm #12393Rob
MemberTribal Council…I can get behind that terminology 🙂
I’d think this is doable, but it’s a bit outside my area of expertise. Let me get our developer Jonah to chime in with any suggestions he may have along these lines. He’ll jump in here tomorrow morning when he hits the forum.
December 16, 2011 at 8:48 am #12440murphy1976
MemberWell I figured since y’all are Modern Tribe… Tribal Council seemed appropriate… HA HA.
December 16, 2011 at 5:46 pm #12475Rob
MemberHeh. Just a heads up, I was incorrect in my note earlier…since our team is winding down for the holidays, support will be a bit less frequent than usual over the next week or two. We will get you a response on this issue sometime early next week though. Apologies for the inconvenience by wrongly setting your expectations for today.
December 29, 2011 at 7:37 am #12726murphy1976
MemberHUZZAH!
I have figured out the answer to my own question. It’s a make-shift answer, BUT an answer nonetheless.
What I wanted to do was to have a special div only appear when there was an event that was occurring TODAY.
After hours of searching the internet and conversing with the boys over at Stackoverflow.com, I was able to come up with the solution:
I placed this custom WP_Query in my header.php (where the DIV actually is):
get_results(
"
SELECT $wpdb->posts.*
FROM $wpdb->posts, $wpdb->postmeta
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
AND $wpdb->postmeta.meta_key = '_EventStartDate'
AND $wpdb->postmeta.meta_value BETWEEN TIMESTAMP(CURDATE()) AND DATE_ADD(TIMESTAMP(CURDATE()), INTERVAL 86399 SECOND)
AND $wpdb->posts.post_type = 'tribe_events'
AND $wpdb->posts.post_status = 'publish'
ORDER BY $wpdb->posts.post_title
");if ($todaysEvents):
?><?php foreach ( $todaysEvents as $tE ) {
<a href="guid ?>">post_title ?>
The WP_Query selects ONLY those entrants into the database that match the following criteria: Both in POSTS & POSTMETA, POSTMETA_KEY = “EVENTSTARTDATE”, POSTMETAVALUE = TODAY from Midnight to 11:59:59PM, POST_TYPE are “Tribe_EVENTS” and POSTS are published
I then put this into a foreach loop and caled the post’s guid for the link and the post_title for the title… and BOO-YA-SHA-KAH!
Not bad for a designer…
January 2, 2012 at 5:25 pm #12765Rob
MemberNice! Awesome to hear you got this resolved; and I apologize for not getting someone on our end to respond before you had to go dig this up yourself. Seems like your solution should work fine here so I think it’s safe to say we’re set here, unless you disagree.
Let us know if anything else comes up. Happy new year!
July 2, 2015 at 5:00 pm #974968Support 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 ‘Event Calendar Pro "has_event" ?’ is closed to new replies.
