Forums
Home / Themes and Templates / Embedded links in custom field
(@thorhammer)
14 years, 1 month ago
Hi, is it possible to put embedded links as custom field values?
like: Link 1, Link 2
I only get echoed with “Array”, since the custom field value reminds about an array, sort of. I need a workaround to get this to work. Anyone who can help me with any hint?
(@michaelh)
If custom field is present, formulate and display link from meta value
<?php $link = get_post_meta($post->ID, 'link_url', true); $text = get_post_meta($post->ID, 'link_text', true); if ($link){ echo 'Credit: <a href="'.$link .'">'.$text.'</a>'; } ?>
MichaelH: Thanks! You probably saved my night! 🙂