Andy Williams

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Filter not working during ajax call #1266591
    Andy Williams
    Participant

    My filter is in a child theme functions file, here is the filter:

    add_filter( 'tribe_events_event_schedule_details', 'filter_tribe_data_events_page', 10, 2 );

    Here is the function:

    function filter_tribe_data_events_page( $results, $id ) {
    global $global_jesintranet_event_image_bool;
    $start_date = tribe_get_start_date( $id, false, 'M d' );
    $start_day = tribe_get_start_date( $id, true, 'l ' );
    $start_time = tribe_get_start_date( $id, true, 'g:i A' );
    $end_date = tribe_get_end_date( $id, false, 'M d' );
    $end_time = tribe_get_end_date( $id, true, 'g:i A' );
    $time_zone = tribe_get_end_date( $id, true, 'T' );
    $address = tribe_get_address( $id );
    $address = !empty( $address ) ? $address : '';
    $city = tribe_get_city( $id );
    $city = !empty( $city ) ? $city : '';
    $state = tribe_get_state( $id );
    $state = !empty( $state ) ? $state : '';
    $zip = tribe_get_zip( $id );
    $zip = !empty( $zip ) ? $zip : '';
    $empty = '';
    if( $start_date !== $end_date ) {
    $end_time = '';
    }
    else {
    $end_time = ' - ' . $end_time;
    }
    $title = get_the_title( $id );
    $event_data = '

    ';
    $event_data .= '

    ' . $start_date . '

    ';
    $event_data .= '

    ' . $start_day . '

    ' . $start_time . '' . $end_time . '

    ';
    $event_data .= '

    ' . $title . '

    ';
    if( isset( $global_jesintranet_event_image_bool ) && $global_jesintranet_event_image_bool ) {
    $event_data .= '

    ' . tribe_event_featured_image( null, 'events-list' );
    $event_data .= '' . tribe_events_get_the_excerpt() . '';
    $event_data .= '

    Learn more

    ';
    }
    else {
    $event_data .= '' . tribe_events_get_the_excerpt() . '';
    $event_data .= '

    Learn more

    ';
    }

    if ( $address ) {
    $event_data .= '

    ' . $address . ' ' . $city . ', ' . $state . ' ' . $zip . '

    ';
    }
    $event_data .= '

    ';
    return $event_data;
    }

    I have even tried replacing the contents of my function with the contents of the original function from /plugins/the-events-calendar/src/functions/template-tags/general.php line 961 (altering the return statement to return $schedule instead of the filter to avoid the ol’ infinite loop, of course). Added ‘this is mine’ to the html, which displays as expected on load, but not after the ajax call, so same problem.

    Thanks!

Viewing 1 post (of 1 total)