Function Reference: geodir_event_title_recurring_event

Summary

This function has not been documented yet.

Source File

geodir_event_title_recurring_event() is located in geodir_event_manager/gdevents_hooks_actions.php [Line: 204]

Source Code

function geodir_event_title_recurring_event( $title, $post_id ) {
	global $post, $geodir_date_format;

    $gd_post_type = !empty( $post ) && isset( $post->post_type ) ? $post->post_type : '';
    if ( $gd_post_type != 'gd_event' ) {
		return $title;
	}
	
	// Check recurring enabled
	$recurring_pkg = geodir_event_recurring_pkg( $post );
	
	if ( !$recurring_pkg ) {
		return $title;
	}
	
	if ( !empty( $post ) && !empty( $post_id ) && isset( $post->ID ) && $post->ID == $post_id && isset( $post->post_type ) && $post->post_type == 'gd_event' && !empty( $post->is_recurring ) ) {
		
		$current_date = date_i18n( 'Y-m-d', current_time( 'timestamp' ));
		$current_time = strtotime($current_date);
		
		if ( !empty( $post->event_date ) && geodir_event_is_date( $post->event_date ) ) {
			$event_start_time = strtotime(date_i18n( 'Y-m-d', strtotime($post->event_date)));
			$event_end_time = isset($post->event_enddate) && geodir_event_is_date($post->event_enddate) ? strtotime($post->event_enddate) : 0;
			
			if ($event_end_time > $event_start_time && $event_start_time <= $current_time && $event_end_time >= $current_time) {
				$title .= " " . wp_sprintf( __( '- %s', GEODIREVENTS_TEXTDOMAIN ), date_i18n( $geodir_date_format, $current_time ) ) . "";
			} else {
				$title .= " " . wp_sprintf( __( '- %s', GEODIREVENTS_TEXTDOMAIN ), date_i18n( $geodir_date_format, strtotime( $post->event_date ) ) ) . "";
			}
		} else {
			if ( is_single() && isset( $_REQUEST['gde'] ) && geodir_event_is_date( $_REQUEST['gde'] ) && geodir_event_schedule_exist( $_REQUEST['gde'], $post_id ) ) {
				$title .= " " . wp_sprintf( __( '- %s', GEODIREVENTS_TEXTDOMAIN ), date_i18n( $geodir_date_format, strtotime( $_REQUEST['gde'] ) ) ) . "";
			}
		}
	}
	return $title;
}