Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #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?


    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…


    Hi Dude,

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


    - Lily


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


    Thank you :)

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



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



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.