Skip Navigation

[Resuelto] Types url field without displaying http://

This support ticket is created hace 7 años, 2 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 3 respuestas, tiene 3 mensajes.

Última actualización por rubenB hace 7 años, 2 meses.

Asistido por: Shane.

Autor
Mensajes
#491325

I am trying to: add a types url field without displaying "enlace oculto" in front end

f I want to add a link to a website, I must add "enlace oculto" to link to another website. If I do not, it adds the address link to my own website and look like this:
enlace oculto

It would have been nicer if I'm on the site could just show the link address without the http://
So I will not display http:// on the front end of my websit, but I will somehow add it in code so it will work as it had been added.
How do I that?

#491544

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Torjborn,

Thank you for contacting our support forum.

Unfortunately this is not possible as out plugin output the link exactly how you placed it in your backend.

What I would recommend that you do is to create a custom shortcode to retrieve the field value from the database and stripping off the http:// section before displaying it on the frontend.

Please let me know if this helps.

Thanks,
Shane

#1386541

I've seen this done in Drupal Views, so it must be possible...

Can you point us in the right direction to
"create a custom shortcode to retrieve the field value from the database and stripping off the http:// section before displaying it on the frontend"

That sounds like exactly what I want to do.

#1386579

Oh I got this figured out.

function shorturl_shortcode(){
   $weblink = do_shortcode('[types field="website-address" output="raw"][/types]');
$find = array( '<em><u>enlace oculto</u></em>', '<em><u>enlace oculto</u></em>' );
$replace = '';
$output = str_replace( $find, $replace, $weblink );
return '<a href="'.$weblink.'">' . $output . '</a>';

}

add_shortcode('shorturl','shorturl_shortcode'); 

?>

So the field="website-address" is your types website field, and display it using [shorturl]

It would be a nice feature to have this as a built in option in Views though, https:// still scares visitors.

Este ticket ya está cerrado. Si eres cliente de Toolset y necesitas ayuda relacionada, abre un nuevo ticket de soporte.