Add a little check to your code
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>';
//Add this condition to your code
$meta = genesis_get_custom_field( 'article_reference' );
//Remove white space from both sides,
if( !empty(trim($meta)) ){
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 -->';
}
If its not empty show it, otherwise don’t.
Edited:
You can do something like this for further conditions
if($meta == 20)
{
echo 'do 20';
}
elseif ($meta == 21)
{
echo 'do 21';
}
else
{
echo 'If all condition fails this will be echo';
}