Created
May 16, 2016 15:24
-
-
Save alenabdula/3c16d3c370e9772eb9c224ad8b13312a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* File field returning ID | |
*/ | |
if ( get_post_meta($post->ID, 'ENTER_KEY', true) ) { | |
$id = $cfs->get('ENTER_KEY'); | |
$src = wp_get_attachment_image_src($id, 'large'); | |
$alt = get_post_meta($id, '_wp_attachment_image_alt', true); | |
echo '<img src="' . esc_url($src[0]) . '" alt="' . $alt . '">'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment