/** Echos the schedule for the current post. */ function ec3_the_schedule($format_single = EC3_DEFAULT_FORMAT_SINGLE, $format_range = EC3_DEFAULT_FORMAT_RANGE, $format_wrapper = EC3_DEFAULT_FORMAT_WRAPPER) { echo ec3_get_schedule($format_single, $format_range, $format_wrapper); }
/** Replaces default wp_trim_excerpt filter. Fakes an excerpt if needed. * Adds a textual summary of the schedule to the excerpt.*/ function ec3_get_the_excerpt($text) { global $post; if (empty($text)) { $text = $post->post_content; if (!$post->ec3_schedule) { $text = apply_filters('the_content', $text); } $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = 55; $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); } } if ($post->ec3_schedule) { $schedule = ec3_get_schedule('%s; ', "%1\$s %3\$s %2\$s. ", '[ %s] '); $text = $schedule . $text; } return $text; }