update get_post_thumbnail_url, 2.0.3

This commit is contained in:
Lukas Juhas 2017-01-17 11:56:53 +00:00
parent 38e1e4bf1d
commit fa0983d5bd
3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,6 @@
# barebones changelog
## 2.0.3
* update get_post_thumbnail_url function and add ability to get specific size.
## 2.0.2
* Add dependencies that were missing while using yarn

View File

@ -177,12 +177,16 @@ add_filter('tiny_mce_before_init', 'barebones_tiny_mce_before_init');
/**
* Get post thumbnail url
*
* @param int $post_id
* @return string
* @param string $size Size of the returned image
* @param int $post_id post id
* @param boolean $icon if no image found, display icon
*/
function get_post_thumbnail_url($post_id)
function get_post_thumbnail_url( $size = 'full', $post_id, $icon = false )
{
return wp_get_attachment_url(get_post_thumbnail_id($post_id));
if(!$post_id) {
$post_id = get_the_ID();
}
$thumb_url_array = wp_get_attachment_image_src(get_post_thumbnail_id( $post_id ), $size, $icon);
return $thumb_url_array[0];
}

View File

@ -1,6 +1,6 @@
{
"name": "barebones",
"version": "2.0.2",
"version": "2.0.3",
"author": "Benchmark Studios",
"description": "A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond",
"license": "MIT",