Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8231

    Is there a theme function (or WordPress function) that will let me get the URL of the (first) featured image associated with the post, when I am in the single post view?

    #60746

    Yes – you can use following code to get the first featured image – if you replace [0] with [1] you’ll get the second and so on:

    $slides = avia_post_meta($post->post_id, 'slideshow');
    if ($slides){
    $postimage = avia_image_by_id($slides[0]['slideshow_image'],'thumbnail',$output = 'url');
    echo $postimage;
    }

    You can replace “thumbnail” with another image size too…

    #60747

    Hi Dude,

    The code you gave me displays the image. I don’t want to display it, I just want the URL.

    Help?

    - Lily

    #60748

    I changed the code. Only the url will be returned now.

    #60749

    Thank you :)

    How do I set the size of the thumbnail in the theme/Wordpress settings?

    #60750

    Hey!

    You can change the slideshow/image dimensions in functions.php (I’d only adjust the height value). Afterwards regenerate the thumbnails with: http://wordpress.org/extend/plugins/regenerate-thumbnails/

    Regards,

    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Retrieving URL of featured image for a post, in single post view?’ is closed to new replies.