Hi All, I think it's a synthax issue I have, I'm new to php coding as you can undoubtedly see from this code, but
What I'm trying to do below is Check if get_post_meta( get_theID(), 'jv_item_video1', true ); has been filled in and if it has then show whats in the <iframe></iframe>
Upto now the previous part would display a video from the users input, but if they didnt input into that specific field, it would show the frame with a 404 error inside, so I tried to add the if statement.
Any help is much appreciated:)
<?php $youtube_link = get_post_meta( get_the_ID(), 'jv_item_video1', true ); ?>
<?php
if (!empty($youtube_link)) {
?>
<iframe width="300" height="200" src="<?php echo str_replace('watch?v=','embed/', $youtube_link); ?>" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<?php
}
?>
Previous -
<?php $youtube_link = get_post_meta( get_the_ID(), 'jv_item_video1', true ); ?>
<iframe width="300" height="200" src="<?php echo str_replace('watch?v=','embed/', $youtube_link); ?>" frameborder="0" allowfullscreen></iframe>
</div>
</div>