• Hi all,
    Is it possible to pass the thumbnail URL to a variable rather than output the image tag? Please excuse my PHP ignorance.

    Thanks! -D

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Chris Scott

    (@chrisscott)

    You can use MultiPostThumbnails::get_the_post_thumbnail() and pass in the same arguments you would to MultiPostThumbnails::the_post_thumbnail(). That won’t echo it so you can assign it to a variable.

    Hi Chris,

    The plugin is awesome, but when I use get_the_post_thumbnail() I still get all of the associated “img” tag, where all I am looking for is the URL to the image… Is this what should be happening? Surely I can parse it, but wanted to make you aware.

    WP 3.0.1

    Thanks,

    –d

    Plugin Author Chris Scott

    (@chrisscott)

    Sorry, this should work:

    $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id($post_type, $thumb_id, $post_id);
    wp_get_attachment_url($post_thumbnail_id);

    where the args to get_post_thumbnail_id are the same you’d pass into MultiPostThumbnails::the_post_thumbnail()

    Chirs, I really need your help! 🙂 Ive been pulling my hair out all evening 🙁 its 2am and still no solution

    I’ve NO idea how to implement the code you provided.

    I use the following code to check if theres a thumbnail called four-image, if there is, it shows the thumbnail…

    <?php if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('post', 'four-image')) { ?>
    
    <a href="#?color=Orange" onclick="switchImg('#')"><?php MultiPostThumbnails::the_post_thumbnail('post', 'four-image', NULL, 'four-image-thumnail'); ?></a>
    
    <?php } ?>

    But I also need to be able to call the url of the thumb and insert that into the (‘#’). The reason for this is so when the user clicks the link it changes the main image on my page. http://www.wrapsodyscarves.com.php5-18.websitetestlink.com/pashmina/fuax-fur-stole/

    Please help

    Chris,

    This plugin seems really great, but after following the instructions posted in the Installation and FAQ section of the plugin page on WordPress.com, it’s still not working. I am using the code exactly as it is written in those instances; also, I’ve reviewed the other support topics related to this plugin and have found no success. Is there something that I’m missing?

    Thanks,
    JC

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Multiple Post Thumbnails] Assign Post Thumbnail URL to Variable’ is closed to new replies.