Posted by KaiseRCrazY on 2nd March 2010

Create PDF Button

This is a simple button for display PDF’s with Google Docs. You can easily apply this code into your theme’s functions.php. And this useful thing has 4 lines code. Let’s Begin…

Here is the code;

Add this line into your theme’s functions.php;

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

That’s All. Now use your shortcode;

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

This tip orginally posted in WpRecipes.

  • del.icio.us
  • Digg
  • Facebook
  • FriendFeed
  • Reddit
  • StumbleUpon
  • Technorati
  • PDF
  • Print

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

No comments yet!

Post your comments