Show image based on field selection

image.php

<?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>";
	}
No comments yet.

Leave a Reply