function check_small_image() { | |
/** | |
* Get our meta value for the image | |
* We use get_the_ID() to get the currently used loop post | |
*/ | |
$small_image = get_post_meta( get_the_ID(), 'small-image-meta', true ); | |
/** | |
* Check if there was actualy an image stored | |
*/ | |
if ( $small_image ) { | |
/** | |
* An image was found, we use the printf() function to | |
* output and sanitize our values to avoid exploits and such | |
*/ | |
printf( | |
'<img src="%s" alt="%s" />', | |
esc_url( $small_image ), | |
__( 'Alternative text', 'textdomain' ) | |
); | |
} | |
else { | |
echo 'Hello'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment