This is the code I've added to a single.php file and I need to NOT display the Article Reference echo line, if the custom field value is empty.
I am using Genesis, if that matters.
How should this be written? Also, is there a better way to write this code?
Thanks, Louise
function custom_do_grid_loop() {
// Intro Text (from page content)
echo '<div class="page hentry entry">';
echo '<h1 class="entry-title">'. get_the_title() .'</h1>';
if ( has_post_thumbnail() ) {
echo '<div class="import-image">' . get_the_post_thumbnail() . '</div>';
}
echo '<div class="entry-content"><p>' . get_the_content() . '</p>';
echo '<div class="field_name"><strong>Article Reference:</strong> ' . genesis_get_custom_field( 'article_reference' ) .'</div>';
echo '</div><!-- end .entry-content -->';
echo '</div><!-- end .page .hentry .entry -->';
}