Embed Google Drive Folder in WordPress

>>>>>You can find an updated version here.

As WordPress and Google Drive continue to blend in a variety of ways the desire to embed the contents of Google Drive folders has come up a few times.

I found this Stack Overflow post a while back and had been using it myself. But in an attempt to get around iframe issues and make it a little friendlier I wrote a quick and dead simple plugin today. It seems to do the trick . . .

Directions

Assuming the plugin is installed and activated . . .

Go to Google Docs. Get the unique ID for the folder you want to embed- seen in the highlighted portion of the URL in the image below.
Screen Shot 2014-12-11 at 2.50.37 PM

Then paste it between the shortcodes like so . . .

Screen Shot 2015-01-14 at 3.03.20 PM
and you get a nice little window that acts as a live interactive portal to the folder.

Comments on this post

  1. CogDog said on December 11, 2014 at 4:13 pm

    Good to know you can get around multisite limits on iframes this way. If there were other kinds of things you can embed from gdrive, maybe add an option to the shortcode (default is folder view, leaves room for others) — https://gist.github.com/35370800a2a6b5b65ee9.git

    • Tom Woodward said on December 11, 2014 at 8:44 pm

      I figured you might have a word of advice. I really want to see that gist but it doesn’t seem to want to load for me.

  2. Chris said on March 22, 2015 at 8:12 pm

    Using your shortcode, how would I be able to change from list to grid view?

    • Tom Woodward said on March 22, 2015 at 8:54 pm

      Chris,

      That one didn’t have that option but I wrote a new version to do that. It’s slightly different in that the shortcode would be gdrive id=”YourFolderID” style=”grid” (but with square brackets). It works on my quick testing but I wrote it just a minute ago so let me know if it doesn’t do what you’d like.

  3. schultzter said on May 28, 2015 at 4:16 pm

    Is there a way to specify the sort order of the documents? I’m looking for reverse on the title (my titles start with the date like YYYY-MM-DD so the most recent is first) or have the most recently modified at the top (not guaranteed because I might rarely have to modify a previous upload but good enough). Thanks,

    • Tom Woodward said on May 28, 2015 at 8:20 pm

      I’m not seeing any options that would enable that. Forums seem to say no. I’ve look around a bit at the API and don’t really see that option either. Folders really seem to be treated as an afterthought. If I find anything else I’ll update here.

Leave a Reply

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL