Hi, I’m implementing an outbrain widget on my site.
They ask to replace the var DROP_PERMALINK_HERE for the permanent link of the page.
There is a native template function that I can call? or do I have to add something in the function.php?
tks
Hey Rafael,
No, you can paste this code into the text editor (standard wordpress pages) or you can use the “Code” element of the advanced layout builder to embed this widget code into an advanced layout page.
Best regards,
Dude
I guess I was not clear.
How do I make DROP_PERMALINK_HERE the url of the page?
There is anything already in the template that does that?
tks
Hey!
There’s no wordpress or theme shortcode which outputs the page url. However you can add this code to the child theme functions.php file:
function avia_get_permalink_shortcode($atts)
{
extract(shortcode_atts(array('id' => 0), $atts));
return get_permalink($id);
}
add_shortcode('av_permalink', 'avia_get_permalink_shortcode');
and then use this shortcode
[av_permalink]
to output the url of the current page. You can also output the url of a specific page by adding the id parameter like:
[av_permalink id=30]
This shortcode would output the url of the page with the id 30.
Best regards,
Peter
works! tks