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.


Related posts:

If you enjoyed this post, make sure you subscribe to my RSS Feed
Comments are closed.
Highslide for Wordpress Plugin