Skip to content

Commit

Permalink
fix: image thumbnail sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin committed Jan 19, 2024
1 parent 4f6242a commit 170514a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/php/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ private static function getPost($post)
$categories = array_map(function (\WP_Term $term) {
return $term->name;
}, wp_get_post_terms($postId, 'category'));

// var_dump(get_the_post_thumbnail($post, 'medium'));
// $imageId = get_post_thumbnail_id($post->ID);
// var_dump(wp_get_attachment_image_src($imageId, [110, 60]));
// die;
//Post details
$result = array(
'uuid' => Id::getId($postId),
Expand All @@ -290,7 +293,7 @@ private static function getPost($post)
'post_date' => strtotime($post->post_date),
'post_date_formatted' => date(get_option('date_format'), strtotime($post->post_date)),
'post_modified' => strtotime($post->post_modified),
'thumbnail' => get_the_post_thumbnail_url($post) ? get_the_post_thumbnail_url($post, 'medium') : '',
'thumbnail' => get_the_post_thumbnail_url($post) ? get_the_post_thumbnail_url($post, [480, 270]) : '',
'tags' => $tags,
'categories' => $categories,
'algolia_timestamp' => current_time("Y-m-d H:i:s"),
Expand Down

0 comments on commit 170514a

Please sign in to comment.