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}

3 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:

Hi there,

how would I call for an ACF field, that is placed in a group?
mailto:{acfgroup=yourfieldnamehere} is not working.

Is there a section in the documentation, or a place where I could check for the needed reference from?

Hi @T-low,

First level groups are available through the Dynamic Inserter, which would give you:
{acf_group_field=yourgrouphere=yourfieldhere}

Otherwise, I would recommend the return function since nested grouping would require precise targeting.

1 Like

Hi @Louis,
thank you for the reply.

I was able to get the right reference from the inserter:

But I am not sure for what the Title is for, couldn’t find it in the DOCS.
I then pasted the reference in the link field to get my href (mailto) and added the location of the ACF group.

grafik

This works, I also reset the Title field because I do not know what it is for :sweat_smile:

Have to look into return functions for nested groupings never used them. :face_with_spiral_eyes:

Finally got the email address working as a link with mailto: added.

My setup:

A post template page with the authors email address added as a button block with the text ‘email’ used as the link.

ACF fields set up as a group (field name = contributor_1) which has the authors name, title, email (field name = email_address), linkedin address.

On the button I linked it using:
Type = URL
Source = Static
in the 'Search or type url field, add = mailto:{acf_group_field=contributor_1=email_address}