Using tribe_event_is_on_date() even more conditionally – Part 2

Home Forums Calendar Products Events Calendar PRO Using tribe_event_is_on_date() even more conditionally – Part 2

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1250710
    RANDY
    Participant

    Hi there,

    Previously Josh helped me out with this issue on the original thread, but now I have another request.

    date_default_timezone_set( 'America/Los_Angeles' );
    $date = date( 'U' );
    $start = tribe_get_start_date( get_the_ID(), true, 'U' );
    $end = tribe_get_end_date( get_the_ID(), true, 'U' );
     
    if ( $date > $start && $date < $end ) {
    	echo '<div class="col-xs-12">';
    	echo '<div class="row">';
    	echo '<div class="col-xs-12 col-md-8 col-lg-8 youtube-live">';
    	echo '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/';
    	$youtubecode = tribe_get_custom_fields(); 
    	echo $youtubecode[ 'Youtube Code' ];
    	echo '" frameborder="0" allowfullscreen></iframe>';
    	echo '</div>';
    	echo '<div class="col-xs-12 col-md-4 col-lg-4 youtube-live-chat">';
    	echo '<iframe width="100%" height="100%" frameborder="1" src="https://www.youtube.com/live_chat?v=';
    	$youtubecode = tribe_get_custom_fields(); 
    	echo $youtubecode[ 'Youtube Code' ];
    	echo '&embed_domain=www.provideocoalition.com"></iframe>';
    	echo '</div>';
    	echo '</div>';
    	echo '</div>';

    This is the original code that was being worked with.

    Our goal is this. We are setting our events to run at 11:30AM PST. However, we want this code to initialized at 11:00AM PST. That would mean 30 minutes before the start time.

    #1251483
    Cliff
    Member

    Hi, Randy.

    I think all you’d need to do to customize that to what you’re wanting is something like this:

    $start = tribe_get...
    
    $start = $start - 1800; // 1800 seconds equals 30 minutes

    Please let me know how this goes for you.

    #1256111
    RANDY
    Participant

    Awesome thanks!

    #1257025
    Cliff
    Member

    Glad to help. You’re welcome.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Using tribe_event_is_on_date() even more conditionally – Part 2’ is closed to new replies.