Jump to content

Community

"if" statement for custom profile field


Kirill N
 Share

Recommended Posts

Hey guys! Hope everyone is well!

I'm working on a theme for my website and I'm struggling with adding a custom profile field to the postContainer template.

I know the code for custom fields in Pages is this

{{if $record->field_51}}
{$record->customFieldDisplayByKey('key', 'listing')|raw}
{{endif}}

 

What would be the equivalent for this code for custom profile fields?

 

Thanks in advance! 

Edited by Kirill N
Link to comment
Share on other sites

Hello,

Quote
  • $member->profileFields(): Return the custom profile fields for the member as an array of profile field objects.
  • $member->contentProfileFields(): This is similar to profileFields() but instead only returns profile fields designed to display next to the user's content (e.g. in the left sidebar next to a post)

Change $member to $comment->author()

Link to comment
Share on other sites

13 minutes ago, newbie LAC said:

Hello,

Change $member to $comment->author()

Many thanks for the response, I appreciate it.

Unfortunately {$comment->author()->contentProfileFields()} doesn't return anything. I also need to return a specific custom field, not all of them.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy