Advance custom fields variable with if statement & Function

Advance custom fields variable with if statement & Function