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

Cant get thumbnail url #100

Closed radmotivator closed 8 years ago

radmotivator commented 8 years ago

Hi there,

<?php if (class_exists('MultiPostThumbnails')) :
    MultiPostThumbnails::the_post_thumbnail(
        get_post_type(),
        'secondary-image'
    );
endif; ?>

Works fine to display the thumbnail but when I change to

<?php if (class_exists('MultiPostThumbnails')) :
    MultiPostThumbnails::get_post_thumbnail_url(
        get_post_type(),
        'secondary-image'
    );
endif; ?>

Nothing is returned. Does this work in 4.5.1?

Many thanks

chrisscott commented 8 years ago

Like core's get_ vs. the_ template tags, MultiPostThumbnails::get_post_thumbnail_url() doesn't echo. So you'll either need to echo before it or assign it to a variable for future use.