Skip to content

Instantly share code, notes, and snippets.

@ColonelMoutarde
Created February 18, 2020 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColonelMoutarde/4d97749ea06fe641cb76367e2a850621 to your computer and use it in GitHub Desktop.
Save ColonelMoutarde/4d97749ea06fe641cb76367e2a850621 to your computer and use it in GitHub Desktop.
/**
* @param WP_Post $post
* @return string|null
*/
function getPictureTyre(\WP_Post $post): ?string
{
$result = null;
$pathToImg = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'Large size')[0];
if ($pathToImg !== null) {
$result = '<img src="' . $pathToImg . '" class="tyre-post-thumbnail" >';
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment