Skip to content

Commit 61701f3

Browse files
committed
update get_post_thumbnail_url function, 2.0.3
1 parent 71df2f7 commit 61701f3

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# barebones changelog
2+
## 2.0.3
3+
* update get_post_thumbnail_url function and add ability to get specific size.
24

35
## 2.0.2
46
* Add dependencies that were missing while using yarn
57

68
## 2.0.1
7-
89
* Comment out example "add_image_size" as it can be easily forgotten which leaves you with extra unused image size.
910
* Add CHANGELOG.MD to track changes
1011
* Tidy up formatting using PHP-CS-Fixer (mostly spacing)
1112
* Update README.MD dependencies
1213

1314
## 2.0.0
14-
1515
* Refreshed tooling using Elixir with lots of improvements

functions.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,16 @@ function barebones_tiny_mce_before_init($settings)
177177

178178
/**
179179
* Get post thumbnail url
180-
*
181-
* @param int $post_id
182-
* @return string
180+
* @param string $size Size of the returned image
181+
* @param int $post_id post id
182+
* @param boolean $icon if no image found, display icon
183183
*/
184-
185-
function get_post_thumbnail_url($post_id)
184+
function get_post_thumbnail_url( $size = 'full', $post_id, $icon = false )
186185
{
187-
return wp_get_attachment_url(get_post_thumbnail_id($post_id));
186+
if(!$post_id) {
187+
$post_id = get_the_ID();
188+
}
189+
190+
$thumb_url_array = wp_get_attachment_image_src(get_post_thumbnail_id( $post_id ), $size, $icon);
191+
return $thumb_url_array[0];
188192
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "barebones",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"author": "Benchmark Studios",
55
"description": "A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond",
66
"license": "MIT",

0 commit comments

Comments
 (0)