Wordpress简码:简单嵌入PDF
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress简码:简单嵌入PDF相关的知识,希望对你有一定的参考价值。
/* * Code modified by: Street.Walker [at] masedi [dot] net * Simple embedding PDF, Presentation file to blog post with Google view. * ex: http://docs.google.com/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true * or: http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true * embed it with html iFrame: <iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe> * Source from: http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html * implementation for WordPress: use shortcodes * usage: [embedpdf width="600px" height="500px"]http://infolab.stanford.edu/pub/papers/google.pdf[/embedpdf] * adopted from: http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode * * Copy the code and paste it to your functions.php file under your active theme */ function viewpdf($attr, $url) { return '<iframe src="http://docs.google.com/viewer?url=' . $url . '&embedded=true" style="width:' .$attr['width']. '; height:' .$attr['height']. ';" frameborder="0">Your browser should support iFrame to view this PDF document</iframe>'; } add_shortcode('embedpdf', 'viewpdf');
以上是关于Wordpress简码:简单嵌入PDF的主要内容,如果未能解决你的问题,请参考以下文章
WordPress Shortcode(简码)介绍及使用详解