I m having a weird problem, I'm trying to insert a link retrieved from custom field "urladd" ( I'm using Wordpress as cms ) <a href="<?php echo get_post_meta($post->ID, 'urladd', true); ?> " target="_blank"> My link</a> But the link shows the post url and than the link i m trying to extract ! Its like this : http://www.abc.com/mypost/customfieldlink Instead of this how can i show just the custom field link http://[B]customfieldlink[/B] Please somebody help me ! Thanks !
Do you have http:// in front of the custom links? If not, try <a href="http://<?php echo get_post_meta($post->ID, 'urladd', true); ?> " target="_blank"> My link</a>
I dont have but when i insert , it shows - http:/// It works perfectly when i change it to <a href="http://www.abc.com " target="_blank"> My link</a> Also <?php echo get_post_meta($post->ID, 'urladd', true); ?> shows the link as www.abc.com oh. i forgot to mention that i m working on xampp a localserver on my pc.
Great! This is a little better because the link only appears when there is something in the field: <?php if( get_post_meta($post->ID, 'urladd', true) ) :?> <a href="http://<?php echo get_post_meta($post->ID, 'urladd', true); ?> " target="_blank"> My link</a> <?php endif;?> Code (markup):