Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Created November 15, 2012 22:55
Show Gist options
  • Save Pleiades/4082109 to your computer and use it in GitHub Desktop.
Save Pleiades/4082109 to your computer and use it in GitHub Desktop.
Google Docs Viewer
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');
[pdf=http://manuals.info.apple.com/en_US/Enterprise_Deployment_Guide.pdf]Link text.[/pdf]  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment