Beispiel #1
0
 function axiom_get_date_or_difference($dt1, $dt2 = null, $max_days = -1)
 {
     static $gmt_offset = 999;
     if ($gmt_offset == 999) {
         $gmt_offset = (int) get_option('gmt_offset');
     }
     if ($max_days < 0) {
         $max_days = axiom_get_theme_option('show_date_after', 30);
     }
     if ($dt2 == null) {
         $dt2 = date('Y-m-d H:i:s');
     }
     $dt2n = strtotime($dt2) + $gmt_offset * 3600;
     $dt1n = strtotime($dt1);
     $diff = $dt2n - $dt1n;
     $days = floor($diff / (24 * 3600));
     if (abs($days) < $max_days) {
         return sprintf($days >= 0 ? __('%s ago', 'axiom') : __('after %s', 'axiom'), axiom_get_date_difference($days >= 0 ? $dt1 : $dt2, $days >= 0 ? $dt2 : $dt1));
     } else {
         return axiom_get_date_translations(date(get_option('date_format'), $dt1n));
     }
 }
Beispiel #2
0
 function axiom_post_get_period_links($links, $page, $delimiter = '')
 {
     if (!empty($links)) {
         return $links;
     }
     global $post;
     if (in_array($page, array('archives_day', 'archives_month')) && is_object($post)) {
         $year = get_the_time('Y');
         $month = get_the_time('m');
         $links = '<a class="breadcrumbs_item cat_parent" href="' . get_year_link($year) . '">' . $year . '</a>';
         if ($page == 'archives_day') {
             $links .= (!empty($links) ? $delimiter : '') . '<a class="breadcrumbs_item cat_parent" href="' . esc_url(get_month_link($year, $month)) . '">' . trim(axiom_get_date_translations(get_the_date('F'))) . '</a>';
         }
     }
     return $links;
 }