in WordPress

Create Wordpress Shortcode To View PDFs

PDF If your website has some PDF documents which you would like to display to your visitors then it will be usful to the user if they can open it using Google Docs. In the article I will explain how you can make you Wordpress have a shortcode for PDFs to display using Google Docs. ## Why Use Google Docs

Google Docs is a free application from Google which makes it easy to view, edit and share documents through your Google account. Therefore if a user can open up PDFs in Google Docs it will make it very easy for them to save the document and share it with other people on their Google Document lists. ## Code To Create Shortcode To Open Google Docs


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

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email