1

I'm making a theme where the author picture needs to be in one div, but some other fields from the user profile need to be in another.

The fields are all available in the author_picture variable - but I'm a little unclear in Twig how to split it apart into it's relevant pieces.

The author's pic appears to be called user_picture, and the fields are called field_bio and field_title.

I've tried different variations like

{{ author_picture.field_bio.value }} or {{ author.picture.user_picture.value }} etc - but to no avail. What am I missing?

  • I have not worked with user templates, but give this a try {{ content.field_bio }} and {{ content.user_picture }} – No Sssweat Jun 30 '16 at 8:00
0

No Sssweat has right. When you want to display an entity field based on the "Manage Display" settings, you should go just {{ content.my_field }}. If you "kint" content (var dump it) you can see that each content field element has also "theme" key/property, which tells twig how to render that field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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