Skip to content

Instantly share code, notes, and snippets.

@cdmz
Last active August 29, 2015 14:25
Show Gist options
  • Save cdmz/f5446aeb3e49496c24de to your computer and use it in GitHub Desktop.
Save cdmz/f5446aeb3e49496c24de to your computer and use it in GitHub Desktop.
get image using get_post_meta by id
<?php
$logotipo = get_post_meta($post->ID,'logotipo',true);
if($logotipo > 0 AND $logotipo != ''){
$logotipo = wp_get_attachment_image_src( $logotipo );
if(is_array($logotipo) AND count($logotipo) > 0){
$logotipo = array_shift($logotipo);
}else{
$logotipo = '';
}
}else{
$logotipo = '';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment