I am trying to:
change data in a url field
Link to a page where the issue can be seen: hidden link
I expected the link to the customer's website to be: hidden link
Instead, the link is: hidden link
The link worked correctly when I added the customers originally.
This also happened with another customer I tried to correct because I misspelled their domain: hidden link
Thank you
Hello. Thank you for contacting the Toolset support.
You see the output as for your website link field: hidden link
Its because the website link is not started with http:// or https:// protocol.
To solve that I've added the following custom code to "Custom Code" section offered by Toolset:
=> hidden link
function func_check_http_for_url($attr,$content) {
///checking http:// protocol is available or not website
if(strpos($attr['field'], '<em><u>hidden link</u></em>') !== 0) {
return '<a href="<em><u>hidden link</u></em>'.$attr['field'].'" target="_blank">'.$attr['field'].'</a>';
}
return '<a href="'.$attr['field'].'" target="_blank">'.$attr['field'].'</a>';
}
add_shortcode( 'check_http', 'func_check_http_for_url');
And called the above shortcode as given under from your content template:
=> hidden link
[php]
[check_http field="[types field='website' output='raw'][/types]"]
</coce>