|
|
Encode URL in View Template
Started by: Guillaume
in: Toolset Professional Support
Quick solution available
Problem:
The issue here is that the user wanted to encode their URL on the frontend.
Solution:
This can be done by using the following custom shortcode.
// Add Shortcode
function wpc_encode_url( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'url' => '',
),
$atts
);
return urlencode($atts['url']);
}
add_shortcode( 'wpc_encode_url', 'wpc_encode_url' );
Then be triggered like below.
[wpc_encode_url url='[types field="url-produit" output="raw"][/types]']
Add the function to your Toolset custom code settings at Toolset -> Settings -> Custom Code.
|
|
2 |
5 |
4 years, 3 months ago
Guillaume
|