This is a very small thing, but I can't seem to get the syntax right. I am trying to print out the url of a link field into a theme template, so that I can wrap another field with an anchor.

<?php  print render($content['field_link']); ?>

This renders the full field, which is not what I want. How can I print the raw URL value of the link field?

I tried to get devel to give me some output for the field, but had trouble getting the field array to print at all. I tried variations of:

<?php  print $field_bio_link[0]['url']; ?>

to no avail. Any tips?


I did end up figuring out that for devel I needed in the page.tpl.php:

<?php  print $messages; ?>

for the output to show up. I forgot. Now that I have that output rendering, I have finally gotten it with:

<?php print $content['field_link']['#items'][0]['url'];?>

Thanks for joining me on this journey through remembering the right way to use devel, I'd like to thank my 4 year old, and very little sleep, for making this processing post happen.

If any future me finds this, printing field info with a template with devel is as easy as:

<?php print dpm($content['field_name']);?>