How to get dynamically link to thumbnail in Wordpress -


how instead of href="img/1.jpg, image thumbnail url wordpress function..

<a class="popup-link" href="img/1.jpg"></a> 

you can image thumbnail url wordpress function..

<?php wp_get_attachment_image_src( $attachment_id, $size, $icon ); ?>  

sample usage example :

<?php $imgarray = wp_get_attachment_image_src( get_post_thumbnail_id($post->id),'full'); $imgurl = $imgarray[0]; ?> <a class="popup-link" href="<?php echo $imgurl;?>"></a> 

reference codex

https://codex.wordpress.org/function_reference/wp_get_attachment_image_src


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -