In single.php, I am trying to get the value of a custom field that has the web site of the post entry in a custom field “wpcf-website”. So I tried:
<?php if (get_post_meta($post->ID, 'wpcf-website', true)) { ?>
<p>Web Site: <a href="http//:<?php echo get_post_meta($post->ID, 'wpcf-website', true); ?>" target="_blank"><?php echo get_post_meta($post->ID, 'wpcf-website', true); ?></a></p>
<? }?>
Which works in that in displays OK, but the actual link is inside my site, and therefore broken:
http://mysite.com/my-post-name/http//:www.ccbtoday.org
How do I get it to display the value of the field, simply prepended with http://?
If that’s the actual code from your site, you’ve got a typo in the http protocol. It should be “http://”, not “http//:”. That’ll fix the issue you’re seeing.