How To Create a PDF viewer shortcode in WordPress


Sponsored Links






WordPress PDF Shortcode use google docsDid you know, we can create PDF viewer shorcode in WordPress with easy steps? All need to do only using Google Docs viewer tools and integrated it into our WordPress site. The first thing we should do, is written shortcode function in our functions.php theme files.

Simple Method PDF Shortcode functions

function pdflink($attr, $content) {
	if ($attr['href']) {
		return '<a class="pdf" href="http://docs.google.com/viewer?url=' . $attr['href'] . '">'.$content.'</a>';
	} else {
		$src = str_replace("=", "", $attr[0]);
		return '<a class="pdf" href="http://docs.google.com/viewer?url=' . $src . '">'.$content.'</a>';
	}
}
add_shortcode('pdf', 'pdflink');

And done, how to use PDF Shortcode? it’s simple just write down this tiny code on your content

[pdf href="http://yoursite.com/linktoyour/file.pdf"View PDF[/pdf]

Thanks for NoScope for this great tips and we hope you can do it on your own WordPress site

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

How To Filter caption-Shortcode in WordPress

WordPress 2.5 and up added new featured that called wp-caption, this is nice custom, you can add extra text on your image post, beside that tricks you can explore more with this featured. My bigg problem is the default wp-caption … Read More

Added Permalinks Shortcode on WordPress

WordPress is: Themes, Plugins, Widget, Shortcode, PHP and GPL Licensed. Did you know that, beside Widgets, Another useful WordPress API is shortcode, and now I will show you how to added permalinks shortcode into our WordPress site. Why this shortcod

Enable Shortcode in Widget

There are simple ways to Enable Shortcode in Widget Area. Using WordPress, there are almost unlimited possibilities, one nice featured that you should learn and uses is Shortcode. With WordPress shortcode, WordPress content writer will be more easier

How To inserting Google Maps into WordPress

Today Tutorial is How To inserting Google Maps into WordPress Posts/Pages without Plugin, we only need to write Google Maps shortcode and we can put our own maps with really easy ways. The first time is write down this code … Read More

How To Integrate Images Shortcode with TimTumb

Every WordPress Developer has seen that TimTumb is wonderful script, This script is better handle to resize image on the fly and display it what ever size we want and we need. Let's me show you How To Integrate Images … Read More

How To Use WordPress shortcode in theme files

Our recent client need some plugin that display the code using shortcode, like we all know, mostly shortcode must be injected or put on post content. Sometime we have another problem, we need to use the shortcode but not in … Read More

WordPress tip: Create a PDF viewer shortcode

Daily recipes to cook with WordPress If you’re using PDF files on your WordPress blog, it could be very cool to give your users the chance to open them using read more

Source: http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode

How To Create a PDF viewer shortcode in WordPress / WordPress

Did you know, we can create PDF viewer shorcode in WordPress with easy steps? All need to do only using Google Docs viewer tools and integrated it into our WordPress read more

Source: http://wptricks.net/how-to-create-a-pdf-viewer-shortcode-in-wordpress/

Wordpress shortcode : Simple embedding PDF - PHP - Snipplr Social

* adopted from: http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode * read more

Source: http://snipplr.com/view/35682/wordpress-shortcode--simple-embedding-pdf/

femei futute an somn de animale - WordPress Tricks & Tips

How To Create a PDF viewer shortcode in WordPress March 2nd, 2010 By WP Tricks Posted in Tricks read more

Source: http://wptricks.net/archives/femei-futute-an-somn-de-animale

Creating a Simple Button Shortcode in WordPress

Shortcode is the hottest trending topic in WordPress. See how to create a simple button shortcode within Simple PDF viewer for WordPress blog; Creating Multiple Widget read more

Source: http://www.webfroze.com/design/creating-a-simple-button-shortcode-in-wordpress/


7 Responses to How To Create a PDF viewer shortcode in WordPress

  1. Irina says:

    Hello

    Do you happen to know if you can remove the print and download links from the viewer?

    Thanks

  2. Hey thanks, great tips! Never thought about using Google Docs as a direct document viewer. Guess it makes sense. I’ll be sure to use it in a future project!

  3. Pingback: wp-popular.com » Blog Archive » How To Create a PDF viewer shortcode in WordPress # WordPress Tricks & Tips

  4. artamart says:

    great tips, thanks for sharing
    is this violate google TOS ?

  5. Nathan says:

    The only problem with this is, if the person viewing your website is not signed in to google – they will not see your pdf docs.

    Does anybody know a workaround for this problem?

    • WP Tricks says:

      I will re write this trick with another way, I hope will fix this problem..

    • Anays says:

      yes this is awesome and i will be incorporating this in my education blog. Although Nathan is right, it would be ideal for all to see. awesome, im still going to do it as my students have gmail, and most of their work is on a private level.
      Thanks,
      Anays

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>