Event Calendar Pro "has_event" ?

Home Forums Calendar Products Events Calendar PRO Event Calendar Pro "has_event" ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #12344
    murphy1976
    Member

    Good 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.

    #12393
    Rob
    Member

    Tribal 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.

    #12440
    murphy1976
    Member

    Well I figured since y’all are Modern Tribe… Tribal Council seemed appropriate… HA HA.

    #12475
    Rob
    Member

    Heh. 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.

    #12726
    murphy1976
    Member

    HUZZAH!

    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…

    #12765
    Rob
    Member

    Nice! 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!

    #974968
    Support Droid
    Keymaster

    This 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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Event Calendar Pro "has_event" ?’ is closed to new replies.