function the_date_link($format = 'F, jS Y') { global $loop; $date = get_date('post.date', $loop->current_post()); if (!$date) { return; } if ($date instanceof \Prismic\Fragment\Date) { $date = $date->asDateTime(); } $label = date_format($date, $format); $url = archive_link($date->format('Y'), $date->format('m'), $date->format('d')); echo '<a class="created-at" href="' . $url . '">' . $label . '</a>'; }
function get_day_link_url() { $now = new DateTime('now'); if (!$year) { $year = $now->format('Y'); } if (!$month) { $month = $now->format('m'); } if (!$day) { $day = $now->format('j'); } $date = DateTime::createFromFormat('Y-m-d', $year . '-' . $month . '-' . $day); $label = date_format($date, 'F, jS Y'); return archive_link($year, $month, $date->format('d')); }