Function return for link

I want to set an anchor for the post url element in a new window. Like /events/festival-in-vienna/#live so if someone clicks on the button of a custom post type the url should be the post url and an invidivual anchor after the link.

Could we get a function return option for the link element (URL → Dynamic), so I could return it by myself or add a field for inidivual links after the post url?

2 Likes

Being able to return a function for links would be really helpful for me as well.

Was hoping to dynamically append a query parameter to a URL that was set in an ACF field.

To have a Return Function for links would be great. But for maximum flexibility (and no-code) it would be awesome to have complete freedom when constructing dynamic URLs. One approach would be the use of Dynamic Inserters - similar to to the way the paragraph block allows us to insert several dynamic parts with Dynamic Inserters.

I want to set an anchor for the post url element in a new window. Like /events/festival-in-vienna/#live

You should be able to do this with a shortcode:

add_shortcode('my_make_url_shortcode', function ($atts = "") {
	$base_url = 'https://some-url.com';
	return $base_url . '/events/festival-in-vienna/#live';
});

image