RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

PDF with Google Docs and Shortcode

The following shortcode will send the current page (or any other defined page) to Google Docs for printing as a PDF document. This post is a little outdated and shouldn't be relied upon as giving a correct response. We'll get to it soon.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

1
<?php 
2
/*
3
 Print Your Current Page as a PDF with Google Docs and Shortcode
4
 http://www.beliefmedia.com/code/wp-snippets/docs-pdf
5
*/
6
 
7
function beliefmedia_docs_pdf($atts, $content) {
8
 
9
  extract(shortcode_atts(array(
10
    'url' => get_permalink(),
11
    'title' => wp_title()
12
  ), $atts));
13
 
14
 return '<a href="http://docs.google.com/viewer?url=' . urlencode($url) . '" target="_blank" title="' . $title . '" rel="noopener noreferrer">' . $content . '</a>';
15
}
16
add_shortcode('googlepdf', 'beliefmedia_docs_pdf');

Usage

The shortcode will render a link that should be clicked. The shortcode to be used is as follows: [googlepdf]Link text in here[/googlepdf]. If you choose to print another page, use [googlepdf url="http://www.beliefmedia.com/"]Link text in here[/googlepdf]. You can change the link title with the attribute of title in your shortcode.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment