Created
August 10, 2012 06:21
-
-
Save jcanfield/3311713 to your computer and use it in GitHub Desktop.
Wordpress Embed PDF Shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Embed PDF File using shortcode | |
// Usage- [embedpdf | |
function embedthepdf($atts, $content = null) { | |
extract(shortcode_atts(array( | |
"id" => 'default-embed', | |
"url" => 'http://samplepdf.com/sample.pdf', | |
"width" => '990px', | |
"height" => '743px' | |
), $atts)); | |
return '<iframe id="' . $id . '" src="http://docs.google.com/viewer?url=' . $url . '&embedded=true" style="width:' . $width . '; height:' . $height . ';" frameborder="0"></iframe>'; | |
} | |
add_shortcode('embedpdf', 'embedthepdf'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment