I have a content type named: lectures

In this content type I have a field collection field named: field_course_video_slide_sync

This field collection consists of 3 fields: field_start_slide_sec, field_slide_title and field_slide_number

What I'm trying to achieve is to rewrite them into this:

 <li begin="field_start_slide_sec"><a href="#field_slide_number">field_slide_title</a></li>

I've tried tpl.php, preprocess_node, field_get_items and views but nothing seems to work. I can't figure out what I'm missing.

1 Answer 1


Please override field-collection-item.tpl.php file present in the Field Collection module directory. You can put your code in that. Just simply copy it to your theme folder, and place the code inside it.

  • Thanks for the advise. I've created a file in my theme folder field-collection-item--field-course-video-slide-sync.tpl.php and wrapped the items in an '<ul>' but how can I format the 3 fields in this field collection from that tpl file?
    – mlhyyl
    Commented Dec 18, 2015 at 12:54
  • Ok, So I hope your tpl is get called. Now we have a variable in it as $content. So you can check the content in that and print that according to you want.
    – Shubham
    Commented Dec 19, 2015 at 13:46
  • Thanks for pointing me in the right direction. If anyone else wanted to know, here is what I did: I created a field-collection-item--field-course-video-slide-sync.tpl.php with only <?php print render($content); ?> in it. And did the field theming in field--field-start-slide-sec--field-course-video-slide-sync.tpl.php, field--field-slide-title--field-course-video-slide-sync.tpl.php and field--field-slide-number--field-course-video-slide-sync.tpl.php.
    – mlhyyl
    Commented Dec 21, 2015 at 7:15

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.