Link Selector add "Prefix" and "Suffix" for dynamic links

Hey there,

I am often in a situation where I need a dynamic Link but with some additional information. Currently the Link Selector doesn’t allow to add any information to a dynamic selected Link.

Use Cases:

Mailto (with the Mail Address of an ACF Field) …
add “mailto:” as prefix

<a href="mailto:user@example.com">user@example.com</a>

Tel (same as above) …
add “tel:” as prefix

<a href="tel:+4362176589 658">+43 6217 6589 658</a>

More Advanced: Querying child-posts and want to set an anchor-link to their “post URL”:
Add “#Anchor-Link” as Suffix

<a href="/child-post/#Anchor-Link">See post</a>

Does that makes sense?! :wink:

Cheers
Wolfgang

1 Like

I am placing this here because I had that problem today (solved it with a bit of JavaScript):

Also if I want to add a query parameter like

Https://example.com?excl=567

It is currently not possible with the dynamic links (would need the ability to suffix the link in that case)

Correct me if i am overseeing something, please :wink:

I’ve come across this recently too.

Same :raising_hand_man:
In case that’s somehow already natively possible, any guidance is appreciated.

Always depends, but in some cases one can get away by going the custom attributes route.

You mean, assign an <a tag and giving it a custom attribute called href? Would that allow us to input prefix and suffix then (not on the PC right now)

Hi there @Wolfgang,

If I haven’t misunderstood, might this be what you’re looking for Mailto: from query/repeater - #3 by Louis?

I hadn’t though about the Prefix/Suffix idea for dynamic links, and that might just be what is needed for most use cases.

Cheers,

Exactly what @Louis said :+1:
I think this offers even more flexibility.

And yeah, you got it correctly :arrow_down_small:

1 Like

Hey @Louis,

If I don’t get you wrong I have the ability to use dynamic data with the “static” option using the curly brackets? That would definitely solve my problem and would have the same behavior as my suggestion, yes!

Thanks a lot, never thought of looking into the static option when I’m inside a query, that’s why I have probably overseen that possibility :slight_smile:

2 Likes