WordPress.org

Support

Support » Plugins and Hacks » Multiple Post Thumbnails » [Resolved] can't get get_post_thumbnail_url() to work

[Resolved] can't get get_post_thumbnail_url() to work

  • I’m trying to set the secondary featured image as a background image, but when I use the function it only just returns:
    http://www.monkeykode.com/?%3E
    and not the proper url. Is this a bug, or am I implementing it wrong?

      <li style=”background-image:url(‘<?php if (class_exists(‘MultiPostThumbnails’)) : MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), ‘secondary-image’); endif; ?>
      ?>’);”><?php the_post_thumbnail(‘post-thumbnail’, array(‘alt’ => get_the_title(), ‘title’ => get_the_title())); ?>
      <li class=”overlay”>

    Your help would greatly be appreciated!

    http://wordpress.org/extend/plugins/multiple-post-thumbnails/

Viewing 3 replies - 1 through 3 (of 3 total)
  • <li style="background-image:url('<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image'); endif; ?>
    ?>');"><?php the_post_thumbnail('post-thumbnail', array('alt' => get_the_title(), 'title' => get_the_title())); ?>
    <li class="overlay">

    I want to get just the URL of a secondary featured image as well. I tested this a few times and it just doesn’t work. You are following the instructions perfectly.

    I just got it to work using another forum post’s info

    <?php $custom = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'second-image', $post->ID); $custom=wp_get_attachment_image_src($custom,'second image'); echo $custom[0]; ?>

    It brings in the full image but now I can’t seem to figure out how to bring in the smaller sizes. I will start another post to ask the question.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] can't get get_post_thumbnail_url() to work’ is closed to new replies.
Skip to toolbar