Skip to content

Commit

Permalink
feat: adding post dates to post object (#750)
Browse files Browse the repository at this point in the history
Co-authored-by: Niclas Norin <[email protected]>
  • Loading branch information
NiclasNorin and Niclas Norin authored Nov 10, 2023
1 parent 4ae9231 commit 12df36a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions library/Helper/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ public static function complementObject($postObject, $appendFields = [], $data =
$postObject->post_title_filtered = apply_filters('the_title', $postObject->post_title, $postObject->ID);
}

//Set time formats
$postObject->post_time = wp_date(
\Municipio\Helper\DateFormat::getDateFormat('time'), strtotime($postObject->post_date)
);
$postObject->post_date_time = wp_date(
\Municipio\Helper\DateFormat::getDateFormat('date-time'), strtotime($postObject->post_date)
);
$postObject->post_date = wp_date(
\Municipio\Helper\DateFormat::getDateFormat('date'), strtotime($postObject->post_date)
);

//Get post tumbnail image
$postObject->thumbnail = self::getFeaturedImage($postObject->ID, [400, 225]);
$postObject->thumbnail_tall = self::getFeaturedImage($postObject->ID, [390, 520]);
Expand Down

0 comments on commit 12df36a

Please sign in to comment.