I have a content type "Team" to add team members. In this content type I have a link field (called "LinkedIn") which holds the URL to the team member's LinkedIn page. What I want is to use the URL from the link field and use it with a script (provided by LinkedIn). The script looks like this:

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/MemberProfile" data-id="linkedin-profile-link.com" data-format="hover"></script>

I have created a simple text field for the content type "Team" and in a team member node of that content type I copied above code into it and inserted the URL from the "LinkedIn" link field. This works but I would have to edit more 100 team member pages.

How could I automatically load the URL from the "LinkedIn" link field into this script (it needs to be added into data-id="link comes here") and display on every team member page? Can this be done with Display Suite? Or do I need to write a module?

1 Answer 1


You could use a field template in your theme.

Call it something like field--field-linkedin-url.tpl.php (whatever you have called your field. I'm assuming field_linkedin_url for my example. Notice the _'s are converted to -'s in the file name.

In the template put the following html:

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/MemberProfile" data-id="<?php print render($items); ?>" data-format="hover"></script>

It shows something like this:

enter image description here

  • Thanks, Scott. Yes, this is exactly how it should look like. I have implemented your approach, however, the link isn't loaded. If I look at the source, it looks like this: <a id="li_ui_li_gen_1381219277484_0-link" class="li-connect-link" href="javascript:void(0);">
    – criscom
    Oct 8, 2013 at 8:03
  • Hm, this is strange. javascript:void(0) is what's supposed to be three. Still the LinkedIn profile isn't loaded on hover. The wheel is turning on hover, but the profiel doesn't open.
    – criscom
    Oct 8, 2013 at 8:17
  • Got it. I am using Display Suite and there I had to reconfigure the Field display from "Title as link" to "URL, as plain text". Now it works. Thanks Scott, can I buy you a beer or two?
    – criscom
    Oct 8, 2013 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.