Created
July 5, 2017 17:50
-
-
Save ethicka/911b653398fb6e4a1170f8d492c4f395 to your computer and use it in GitHub Desktop.
Wrap Link if URL is Passed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Wrap with Link if URL passed | |
*/ | |
function wrap_if_linked($text, $url) { | |
if($url) { | |
echo('<a href="' . $url . '">' . $text . '</a>'); | |
} else { | |
echo($text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment