jeudi 26 février 2015

Function to get custom post image URL


I have to retrieve the URL from a custom post image, just the URL, like: http://ift.tt/1MWIQMj.


The code which I have to filter is this:



<?php cp_get_image_url(); ?>


which returns this:



<a href="http://ift.tt/183xSE2" class="img-main" data-rel="colorbox" title="Chevrolet A10"><img src="http://ift.tt/1MWITrg" title="6" alt="6" /></a>


I tried some functions using wp_get_attachment_image_src with no success.


Example:



<?php $image = wp_get_attachment_image_src( cp_get_image_url() ); echo $image[0]; ?>




Aucun commentaire:

Enregistrer un commentaire