Mailto: from query/repeater

Hi, I would like to create an employee list with corresponding data and emails as ACF.

I used a email field in ACF and a cwicly repeater to let it pop up un my site. That works fine but I would like the email clickable (mailto:)

I tried different methods but I couldn’t achieve it.

Does somebody have any Ideas how to achieve this?

Edit:
I have an ACF field (containing e-mail in some form).
I would like this field to appear as a clickable link
<a href="mailto:my@field.com">my@field.com or something else</a>

Other Solutions (Repeater):

Do you have a live site?
What’s your exact approach?
Do you use dynamic attributes?

Not aware of a current solution which can give you mailto:my@field.com, by only inserting my@field.com.
You would need to prepend mailto: inside your email field every time but can’t say for sure.
There might be some code snippet which can inject that for you on page load.

1 Like

Hey @T-low,

Must have missed this.

While we don’t currently offer a ready solution for this, you can use the following as a static url:
mailto:{acffield=yourfieldnamehere}

2 Likes

Hi @Marius and @Louis, thanks for the replies.

Works :+1:

I have a custom post type (CPT UI) that contains my staff members.
Each staff member has several fields ACF and also a field for email.
This email field should only contain an e-mal with no code, hence the question.

So I am currently trying to display a dynamic email as a clickable link.

For the solution, I am using a query to filter by the staff I want.
If I want the content to display only the clickable email, I use a header and use the dynamic content to display it. Then I use the code from @Louis to add the clickability (href).
If I want to add something other than just the email, I would wrap that with the header in a div and link that as href.

1 Like

Thanks for elaborating @T-low.
Seems like a common use case.
Will bookmark :sunglasses:

Totally forgot about this approach, thanks for the reminder @Louis, bookmarked as well.

1 Like

Hi, just ran into a new problem.
What if I have a repeater and now want to get one field of that repeater block?

So for example the repeater User has a the fields: user_name, user_email and so on…
With the solution above I tried mailto:{acffield=user_email}, but this doesn’t work.
So I thought this might be some kind of inheritance and tried multiple symbols to reference that inheritance… / \ , ; and so on… example: mailto:{acffield= user/user_email}

I checked out the ACF Sub Field page. But I am really bad with code and couldn’t find a clue.

Am I missing something?

Nearly there :wink: Should work with mailto:{acfrepeater=user_email}.

I’ll add just for reference that acfrepeater only works when inside the repeater.

1 Like

Owww could have thought of that :sweat_smile:

Thanks a lot @Louis :blush: