I am using option tree in my WordPress theme. I am trying to set a theme option for uploading an image for changing the logo image. All is set but I am using this code to show the output, but it doesn't work. How can I solve this ?
<?php
if ( function_exists( 'ot_get_option' ) ) {
$images = explode( ',', get_post_meta( get_the_ID(), 'logo_image_url', true ) );
if ( !empty( $images ) ) {
foreach( $images as $id ) {
if ( !empty( $id ) ) {
$thumb_img_src = wp_get_attachment_image_src( $id, 'logo-small' );
echo '<img src="'. $thumb_img_src[0].'" alt="" />';
} //ENDIF EMPTY ID
} //ENDFOREACH
} //ENDIF EMPTY IMAGES
} //ENDIF FUNCTION EXISTS
?>
The issue might be the if statement checking for the function ot_get_option
. You aren't declaring or using that function so there isn't a need to check if it exists.
You might also check that logo-small
is a valid image size registered with add_image_size
.