I have created a custom meta box for posts and I need to display said data. I have been using the below method to display the data, But I am in need of a slightly different solution.
<a href="<?php echo esc_attr( get_post_meta( get_the_ID(), 'my_meta_box_text4', true ) ); ?>">
<img src="<?php echo esc_attr( get_post_meta( get_the_ID(), 'my_meta_box_text3', true ) ); ?>" alt="" onerror="this.style.display='none'"/>
</a>
What I need is a way to do a IF/Else statement such is. If my_meta_box_text3
exists echo that
, else echo this
.