Skip to content

Commit

Permalink
Fix warning in tag (#718)
Browse files Browse the repository at this point in the history
Co-authored-by: Timotei <[email protected]>
  • Loading branch information
timotei-litespeed and Tymotey authored Sep 26, 2024
1 parent 228f48c commit fd5fef1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/tag.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,17 @@ private static function _build_type_tags()
$tags[] = self::TYPE_AUTHOR . $queried_obj_id;
} elseif (is_date()) {
global $post;
$date = $post->post_date;
$date = strtotime($date);
if (is_day()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Ymd', $date);
} elseif (is_month()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Ym', $date);
} elseif (is_year()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Y', $date);

if($post && isset($post->post_date)){
$date = $post->post_date;
$date = strtotime($date);
if (is_day()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Ymd', $date);
} elseif (is_month()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Ym', $date);
} elseif (is_year()) {
$tags[] = self::TYPE_ARCHIVE_DATE . date('Y', $date);
}
}
}
} elseif (is_singular()) {
Expand Down

0 comments on commit fd5fef1

Please sign in to comment.