Start/End Time in Tooltip Month View

Home Forums Welcome! Pre-Sales Questions Start/End Time in Tooltip Month View

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1071180
    Morgen
    Guest

    I’m a new developer to a website that already purchased The Events Calendar & Pro. Unfortunately I don’t have their login for that purchase but I hope you’ll help me with this anyway.

    I have tried a few different suggestions throughout the knowledge-base and forum but none of them seem to be working properly.

    Currently if I add start & end times to the tooltip code for the month view, it shows the full date: Month, day, & time. I just want the start time and end time not the month or the day. I attempted to add an “additional data” variable in the single-event.php file for the month view. I’ve provided that code below so maybe you can show me where I’m going wrong. I implemented it in the tooltip.php file by using [[= just_start_time]] and [[= just_end_time]] in the place of [[= startTime]] and [[= endTime]]. Any help would be greatly appreciated!

    Code added to/altered at the bottom of single-event.php:

    (all code above this is as originally coded by you)
    *
    */

    // add the additional data and then pass it on to tribe_events_template_data
    $additional_data = array();

    $strings = tribe_get_start_time(null, ‘h:i A’);
    $stringe = tribe_get_end_time(null, ‘h:i A’);
    $additional_data[‘just_start_time’] = tribe_prepare_for_json( $strings );
    $additional_data[‘just_end_time’] = tribe_prepare_for_json( $stringe );

    ?>

    <div id=”tribe-events-event-<?php echo esc_attr( $event_id ); ?>” class=”<?php tribe_events_event_classes() ?>” data-tribejson='<?php echo tribe_events_template_data( $event, $additional_data ); ?>’>
    ” class=”url”><?php echo $title ?>
    </div><!– #tribe-events-event-# –>

    #1071184
    Morgen
    Guest

    Looks like i figured it out, I needed to replace $event with $post in the html implementation since month view uses post.

    However, now I have events that are showing just “-” because no times were entered (it’s an all-day event or it’s just a reminder for a deadline). Is there a test to find out if the start/end times are null so I can hide that div?

    thanks!

    #1071191
    Morgen
    Guest

    ha ha! I figured this one out too, but i’ll post the fix in case it’ll help someone else in the future. This code tests whether or not there’s any start/end times given and if not, then it returns nothing:

    // add the additional data and then pass it on to tribe_events_template_data
    $additional_data = array();

    $strings = tribe_get_start_time(null, ‘g:i A’);
    $stringe = tribe_get_end_time(null, ‘g:i A’);

    if (empty($strings)){$additional_data[‘just_start_time’] = ”;}
    else{ $additional_data[‘just_start_time’] = tribe_prepare_for_json( $strings ) .” – “;}

    if (empty($stringe)){$additional_data[‘just_end_time’] =”;}
    else{$additional_data[‘just_end_time’] = tribe_prepare_for_json( $stringe );}

    ?>

    thanks!
    -m

    #1071267
    Cliff
    Member

    Hi Morgen. Thanks for contacting us… and answering your own question 😉

    For the future, please know that we do not provide support in our Pre-Sales forum. You’ll need to find the login/email address tied to the site’s API key and post new forum threads from that account and in the correct forum (not Pre-Sales) in order to receive support in the future.

    To find your site’s credentials, of course it’d be great if you could get them from the previous developer and once logged in, just change the user account information (e.g. password). If that’s not possible, please send an email to support at theeventscalendar.com from an email address matching your registered site’s domain and provide as much information as possible (e.g. the email address of the purchaser) and we’ll try to be as helpful as possible.

    Thanks!

    #1082443
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Start/End Time in Tooltip Month View’ is closed to new replies.