Title: [Plugin: Google Doc Embedder] Passing Link through Variable
Last modified: August 20, 2016

---

# [Plugin: Google Doc Embedder] Passing Link through Variable

 *  [enkerli](https://wordpress.org/support/users/enkerli/)
 * (@enkerli)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-google-doc-embedder-passing-link-through-variable/)
 * It‘s probably obvious to many other people but it took me a while to figure it
   out and it really makes GDE all that more useful, in my case.
 * As you probably all know, you can use the GDE shortcode in PHP files (say, in
   a template) by using `do_shortcode([gview file="http://example.com/file.pdf"])`.
   What wasn’t clear to me is how to pass a link to that PHP version of the shortcode.
   Again, it must be really obvious, but I got stuck on it, because my knowledge
   of PHP is rather minimal.
    What worked, though, is this:
 *     ```
       $docview = '[gview file="'. $custom["document-link"][0] . '" width="75%" save="1"]';
       echo do_shortcode($docview);
       ```
   
 * `$custom["document-link"][0]` is the content of a custom field which is supposed
   to be a link to an appropriate file. By creating a variable to include the full
   shortcode, I’m able to use GDE to display that file.
    That’s what I’m using in
   my “[syllabus database](http://lar.me/13e)”, for instance displaying a PDF in
   a [syllabus post](http://lar.me/123) (using a syllabus template). Relevant files
   for my syllabus database are [available on my main blog](http://lar.me/13f), 
   if anyone is interested.

The topic ‘[Plugin: Google Doc Embedder] Passing Link through Variable’ is closed
to new replies.

## Tags

 * [code snippet](https://wordpress.org/support/topic-tag/code-snippet/)
 * [Google Doc Embedder](https://wordpress.org/support/topic-tag/google-doc-embedder/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [template files](https://wordpress.org/support/topic-tag/template-files/)

 * 0 replies
 * 1 participant
 * Last reply from: [enkerli](https://wordpress.org/support/users/enkerli/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-google-doc-embedder-passing-link-through-variable/)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
