WordPress supports some embed codes automatically for some sites like YouTube, and Scribd. Embedding Google Docs required adding a plugin to allow them to work correctly.
We have enabled a new plugin to allow the embedding of Google Docs, Sheets, Presentations, and Forms. Here are the instructions on how to use this feature:
Google Docs Shortcode
The shortcode supports the following Google Doc formats:
How to Use
Embedding a document, presentation or spreadsheet
- First, you’ll need to find the public URL of your Google Doc. Let’s start by logging in to your Google Docs. Next, find the item you want to embed.
- You should now have your Google Doc open. Next, navigate to “File > Publish to the Web”. A dialogue box should appear, similar to the one below:
- Make sure that the “Automatically republish when changes are made” checkbox is checked. This will allow you to make changes to your Google Docs and have these changes automatically reflected on your WordPress site.
- Copy the “Document Link” highlighted in red above.
- Now navigate to your WordPress dashboard and open up the post or page where you want to embed your document. On a new line, type the following shortcode and paste in the link you copied, above:
[gdoc link="THE LINK YOU COPIED" height="800"]
You can customize the shortcode by using some custom parameters mentioned below.
Embedding a form
- Follow steps 1-3 above.
- Next, navigate to “Form > Go to live form”. This should take you to the public version of the form. Copy the URL from your browser’s address bar.
- Follow step 5 above.
Other shortcode parameters
Here are some other custom parameters you can use with the shortcode:
- “width” – By default, this tries to use your theme’s content width. If this doesn’t exist, the width is “100%”. Fill in this value to enter a custom width.
- “height” – Enter in a custom height for your Google Doc if desired. Defaults to “300”. Avoid percentages.
- “seamless” – This parameter is only applicable to Documents. If you enter “0”, this will show the Google Docs header and footer. Default value is “1”, which means that no Google Docs header or footer will be shown.
- “size” – This parameter is only applicable to Presentations. You can enter in “small”, “medium” or “large” to use the presentation preset sizes. Dimensions for these presets are: small (480×389), medium (960×749), large (1440×1109). To set a custom width and height, use the “width” and “height” parameters listed above instead.