I am using this function to get the featured images:
<a href="#" rel="prettyPhoto">
<?php the_post_thumbnail('thumbnail'); ?>
</a>
Now I want to get the full featured image on click on the anchor tag for which I need a featured image URL in
<a href="here" rel="prettyPhoto">
How can I fix this?
Check the code below and let me know if it works for you.
If you want JUST the source, and not an array with other information:
Easy way!
This perfectly worked for me:
I think this is the easiest solution and the updated one:
This is the simplest answer:
You can try this:
Try this one
I had searched a lot and found nothing, until I got this:
<?php echo get_the_post_thumbnail_url( null, 'full' ); ?>
Which simply give you the full image URL without the entire
<img>
tag.Hope that can help you.
You can try this.
You can also get it from post_meta like this:
You can also get the URL for image attachments as follows. It works fine.
You will try this
If the post is an image and we already know what the image is, it’s possible to get the thumbnail URL without too much hassle:
Simply inside the loop write
<?php the_post_thumbnail_url(); ?>
as shown below:-if you want to fetch full image size from post thumbnail you can use this code.
here, get_the_ID() is post id.
Use:
You can change the
thumbnail_size
value as per your required size.You can also get the URL for image attachments as follows:
You can get image src for specific size by
wp_get_attachment_url
function.