Julia Miller

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Logic bug in tribe_get_events_title() #929072
    Julia Miller
    Participant

    Well that would fix it since that’s exactly the hack I did in 3.8.

    Thanks for the help, you can close this.

    in reply to: Logic bug in tribe_get_events_title() #928852
    Julia Miller
    Participant

    I don’t have time to repro this with the base theme and no plugins but I assure you those would not affect this. Looking at the original code you have for loop.php (at least in my version 3.8), it’s obvious what is wrong:

    function tribe_get_events_title( $depth = true ) {
    
    		global $wp_query;
    
    		$tribe_ecp = TribeEvents::instance();
    
    		$title = __( 'Upcoming Events', 'tribe-events-calendar' );
    
    		if ( isset( $_REQUEST['tribe-bar-date'] ) && $wp_query->have_posts() ) {
    
    // This is your problem: it displays the *end dates* of the first and last items in the set.  With recurrence
    // that's not necessarily want you'd want.  I did the simple fix of using the requested date for the first one, but
    // actually the second one should be changed as well to be the latest end date in the result set - unless
    // the original query is already sorting by ascending end date (which it might be, I don't recall).
    
    			$first_event_date = tribe_get_end_date( $wp_query->posts[0], false );
    			$last_event_date = tribe_get_end_date( $wp_query->posts[count( $wp_query->posts ) - 1], false );
    
    			$title = sprintf( __( 'Events for %1$s - %2$s', 'tribe-events-calendar'), $first_event_date, $last_event_date );
    ...

    I’ll bet that you cannot repro it right now with those dates I gave since the current date is later, so try

    Repro:
    – delete all pre-existing events
    – create a recurring event that starts 12/1/2014 and ends 6/1/2015
    – create an event that occurs on 1/15/2015
    – search for events on 1/5/2015 (today)

Viewing 2 posts - 1 through 2 (of 2 total)