/** * Gets the formated date of next occurrence of an event * * ### Examples * Inside the loop, you can output the start date of the next occurrence of the current event. * <code> * <?php $next = eo_get_next_occurrence( 'jS M YY' ); ?> * </code> * * Print the start date of the next occurrence of event with id 7 * <code> * <?php echo eo_get_next_occurrence( 'jS M YY', 7 ); ?> * </code> * * @since 1.0.0 * @package event-date-functions * @param string $format The format to use, using PHP Date format * @param int $post_id The event (post) ID, * @return string The formatted date or false if no date exists */ function eo_get_next_occurrence($format = 'd-m-Y', $post_id = 0) { $next_occurrence = eo_get_next_occurrence_of($post_id); if (!$next_occurrence) { return false; } $next = $next_occurrence['start']; /** * Filters the value returned by `eo_get_next_occurrence()` * * @param string|DateTime $formatted_date The DateTime object or formatted returned value (as determined by $format) * @param DateTime $next The next date of this event as a DateTime object * @param string $format The format the date should be returned in * @param int $post_id Post ID of the event */ $formatted_date = apply_filters('eventorganiser_get_next_occurrence', eo_format_datetime($next, $format), $next, $format, $post_id); return $formatted_date; }
/** * Gets the formated date of next occurrence of an event * * ### Examples * Inside the loop, you can output the start date of the next occurrence of the current event. * <code> * <?php $next = eo_get_next_occurrence( 'jS M YY' ); ?> * </code> * * Print the start date of the next occurrence of event with id 7 * <code> * <?php echo eo_get_next_occurrence( 'jS M YY', 7 ); ?> * </code> * * @since 1.0.0 * @package event-date-functions * @param string $format The format to use, using PHP Date format * @param int $post_id The event (post) ID, * @return string The formatted date or false if no date exists */ function eo_get_next_occurrence($format = 'd-m-Y', $post_id = 0) { $next_occurrence = eo_get_next_occurrence_of($post_id); if (!$next_occurrence) { return false; } $next = $next_occurrence['start']; return apply_filters('eventorganiser_get_next_occurrence', eo_format_datetime($next, $format), $next, $format, $post_id); }