Plugin Author
Brecht
(@brechtvds)
Happy to hear you’re enjoying the plugin!
There is a shortcode, but it only takes an encoded parameter at the moment. The easiest way would be to create a VLP in the regular editor and then switch to code view to copy and paste the shortcode to use in your theme files.
Hi, thanks so much for getting back to me so quickly. Thats a good solution, however we wanted to use a variable where the URL would be so it pulls in the embeds dynamically like this:
$url = (something from a custom field);
do_shortcode('[visual-link-preview url="'.$url.'"]);
Thanks again
Plugin Author
Brecht
(@brechtvds)
I’m afraid that’s not possible right now.
What are you trying to achieve specifically?
We have a section of our site which has user submitted links, we very much wanted to emulate the Facebook style link previews which your plugin produces for this area.
Links are submitted through the front-end of the site so we cannot use the VLP in the regular editor.
Plugin Author
Brecht
(@brechtvds)
Well technically that encoded attribute is just a base64 and JSON encoded array, so you could construct it yourself like this:
$encoded = base64_encode(
json_encode(
array(
'type' => 'external',
'url' => '',
'image_id' => '',
'image_url' => '',
'title' => '',
'summary' => '',
'template' => '',
)
)
);
Amazing, that will work, thank you so much for your help and support