Skip to content

Instantly share code, notes, and snippets.

@woodwardtw

woodwardtw/gview.php

Created Mar 26, 2016
Embed
What would you like to do?
dead simple google document viewer shortcode plugin for wordpress
<?php
/**
* Plugin Name: Google Viewer Embed Code
* Plugin URI: http://bionicteaching.com
* Description: Allows an embed of the Google Document viewer [gview]document_URL[/gview]
* Version: .9
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
/* 2016 Tom (email : bionicteaching@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//[gview][/gview]
function gview_shortcode( $atts, $content = null ) {
return '<iframe src="http://docs.google.com/gview?url=' . $content . '&embedded=true" frameborder="0" width="100%" height="600px" scrolling="auto"> </iframe>';
}
add_shortcode( 'gview', 'gview_shortcode' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment