Created
August 21, 2015 22:33
-
-
Save asharirfan/307786d216fd83d5e635 to your computer and use it in GitHub Desktop.
WP Post Featured Image Url Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WP Post Featured Image Url Function | |
* @param string $ai_post_id WP post id | |
* @param string $aa_size WP defined image size | |
* @return string src of featured image | |
*/ | |
function aa_return_img_url($ai_post_id, $aa_size) { | |
$dom = simplexml_load_string(get_the_post_thumbnail($ai_post_id, $aa_size)); | |
$src = $dom->attributes()->src; | |
return $src; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment