Title: Shortcode
Last modified: August 1, 2019

---

# Shortcode

 *  Resolved [Richard B](https://wordpress.org/support/users/richard-b/)
 * (@richard-b)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/)
 * Hi, great plugin, nice and fast too 🙂
    Is there a shortcode or function that
   can be used in theme files where we can use the URL of a page?
 * Like `[visual-link-preview url="https://google.com"]`
 * Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Brecht](https://wordpress.org/support/users/brechtvds/)
 * (@brechtvds)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11789911)
 * 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.
 *  Thread Starter [Richard B](https://wordpress.org/support/users/richard-b/)
 * (@richard-b)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11790104)
 * 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](https://wordpress.org/support/users/brechtvds/)
 * (@brechtvds)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11790299)
 * I’m afraid that’s not possible right now.
    What are you trying to achieve specifically?
 *  Thread Starter [Richard B](https://wordpress.org/support/users/richard-b/)
 * (@richard-b)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11790722)
 * 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](https://wordpress.org/support/users/brechtvds/)
 * (@brechtvds)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11790917)
 * 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' => '',
       		)
       	)
       );
       ```
   
 *  Thread Starter [Richard B](https://wordpress.org/support/users/richard-b/)
 * (@richard-b)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11791048)
 * Amazing, that will work, thank you so much for your help and support

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/visual-link-preview/assets/icon-256x256.png?rev=2010740)
 * [Visual Link Preview](https://wordpress.org/plugins/visual-link-preview/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visual-link-preview/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visual-link-preview/)
 * [Active Topics](https://wordpress.org/support/plugin/visual-link-preview/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visual-link-preview/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visual-link-preview/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 6 replies
 * 2 participants
 * Last reply from: [Richard B](https://wordpress.org/support/users/richard-b/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-676/#post-11791048)
 * Status: resolved