How to use Token Replace only if the field has a value?
You can use the 'clear' option of token_replace to clear any tokens it can't find a replacement for.

&lt;?php print token_replace('[node:author:url]', array('node' =&gt; $node), array('clear' =&gt; TRUE,); ?&gt;"&gt;


As documented here: https://api.drupal.org/api/drupal/includes%21token.inc/function/token_replace/7.x