Created
August 10, 2012 09:54
-
-
Save ms-studio/3313103 to your computer and use it in GitHub Desktop.
Output WP custom field as list
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 | |
$weblinks = get_post_meta($post->ID, 'Web-Link', false); | |
// false = will return an array of results | |
if ($weblinks) { | |
?> | |
<div class="hyperlinks"> | |
<?php | |
foreach($weblinks as $weblink) { | |
// test if it starts with HTTP .... | |
// and remove it | |
$cleanlink = str_replace("http://", "", $weblink); | |
echo '<div class="link"><a href="http://'.$cleanlink.'" target="_blank">'.$cleanlink.'</a></div>'; | |
} ?> | |
</div><!-- .hyperlinks --> | |
<?php } | |
// end if; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment