update get_post_thumbnail_url function, 2.0.3

This commit is contained in:
Lukas Juhas 2017-01-17 12:04:02 +00:00
parent 71df2f7662
commit 61701f305b
3 changed files with 13 additions and 9 deletions

View File

@ -1,15 +1,15 @@
# barebones changelog # barebones changelog
## 2.0.3
* update get_post_thumbnail_url function and add ability to get specific size.
## 2.0.2 ## 2.0.2
* Add dependencies that were missing while using yarn * Add dependencies that were missing while using yarn
## 2.0.1 ## 2.0.1
* Comment out example "add_image_size" as it can be easily forgotten which leaves you with extra unused image size. * Comment out example "add_image_size" as it can be easily forgotten which leaves you with extra unused image size.
* Add CHANGELOG.MD to track changes * Add CHANGELOG.MD to track changes
* Tidy up formatting using PHP-CS-Fixer (mostly spacing) * Tidy up formatting using PHP-CS-Fixer (mostly spacing)
* Update README.MD dependencies * Update README.MD dependencies
## 2.0.0 ## 2.0.0
* Refreshed tooling using Elixir with lots of improvements * Refreshed tooling using Elixir with lots of improvements

View File

@ -177,12 +177,16 @@ add_filter('tiny_mce_before_init', 'barebones_tiny_mce_before_init');
/** /**
* Get post thumbnail url * Get post thumbnail url
* * @param string $size Size of the returned image
* @param int $post_id * @param int $post_id post id
* @return string * @param boolean $icon if no image found, display icon
*/ */
function get_post_thumbnail_url( $size = 'full', $post_id, $icon = false )
function get_post_thumbnail_url($post_id)
{ {
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", "name": "barebones",
"version": "2.0.2", "version": "2.0.3",
"author": "Benchmark Studios", "author": "Benchmark Studios",
"description": "A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond", "description": "A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond",
"license": "MIT", "license": "MIT",