voceconnect / multi-post-thumbnails

Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
143 stars 63 forks source link

is "get_post_thumbnail_url" not working? #97

Closed masterjkk closed 8 years ago

masterjkk commented 8 years ago

I use "if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image'); "

but it seems to be no responding url.

why?

nestor-santana commented 8 years ago

This feature is broken and there has not been an update proposed. So, you cannot echo the URL alone as it stands using "get_post_thumbnail_url()". I needed a solution urgently so I did the following. It might be helpful to have a look at it but I recommend searching for a better long term solution. <?php if (class_exists('MultiPostThumbnails')) : $thumb = wp_get_attachment_image_src(MultiPostThumbnails::get_post_thumbnail_url( get_post_type(), 'extrabg1' ), ‘thumbnail_name’) ; echo $thumb[0] ; endif; ?>

chrisscott commented 8 years ago

@masterjkk if you're expecting that to print the URL, you'll need to echo it. Like core's get_ vs. the_ template tags only the_ echoes the result.

masterjkk commented 8 years ago

@nestor-santana happy to have your reply, it works well. Thanks! I also hope the author make a bugfix about it.

masterjkk commented 8 years ago

@chrisscott thank you!

chrisscott commented 8 years ago

Closing since it doesn't seem like this is a bug but please re-open if I'm mistaken.