Skip Navigation

[Resolved] www. links adding on to root URL

This support ticket is created 4 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by BrandenT2154 4 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1632571

I have a directory site built at hidden link with toolset. one of the fields is a URL field which displays not the front end.

in this field if you type a URL like: "www.example.com" it will save. and if you click on this link on the front end, it will take you to "hidden link" why is this?

here is an example, look at the "Thermal Care" line on this page: hidden link

here is a one-click log in link: staging.ashrae.cloudsend.us/wp-admin/?wtlwp_token=b46b7f2a0eca0f9aa3da8dfe28d28964

#1633049

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The issue was that with your custom field "manufacturers-website" it contains http or https or no host for many URLs that is why you see this issue.

I've added the following code to "Custom Code" section offered by Toolset:
hidden link

add_shortcode( 'display_website_url', 'func_show_website_url');
function func_show_website_url($atts){
global $post;
   
  $atts['url'] = get_post_meta($atts['post_id'],'wpcf-manufacturers-website',true);
   
  
  $url = parse_url($atts['url']);
  if(!isset($url['scheme'])){
    return "//".$url['path'];
  }else{
    return  $atts['url'];
  }
 
 
}

And called the above shortcode within your view:
=> hidden link

<a href="[display_website_url post_id='[wpv-post-id]']" target='_blank' rel="noopener noreferrer"> [types field='manufacturers-website' output='raw'][/types] </a>

I can see now it works as expected. Can you please confirm.

#1633279

that is perfect, thank you so much for that very helpful snippet.