Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created July 27, 2015 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/f29594cdd5e3ce850186 to your computer and use it in GitHub Desktop.
Save tripflex/f29594cdd5e3ce850186 to your computer and use it in GitHub Desktop.
Show image based on field selection
<?php
$is_veteran = get_custom_field( 'is_veteran' );
// Assuming the full URL to the image is //domain.com/banners/veteran.png
// if the value of the selection is "veteran" then it would form that full URL
if( ! empty( $is_veteran ) ){
echo "<img src=\"//domain.com/banners/{$is_veteran}.png\"></a>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment