Creating Printer-Friendly Versions of WordPress Posts and Pages

| WordPress
Creating Printer-friendly Versions of Wordpress Posts

In this tutorial, we'll show you how to place Print This Post buttons into WordPress posts and pages. The main reason you'd want to do this is to extend a courtesy to your readers. Many of them still print things they read online and you don't want them to waste that expensive printer ink just to print your logo and theme as well as the post.

Without this solution, you'd likely need to create a separate CSS file with styles specifically for the printed page. Fortunately, the WP-Print plugin makes this much easier. It will automatically create a printer-friendly version of each post or page.

Install WP-Print Plugin

  • In your WordPress dashboard go to Plugins >> Add New:

01 add new

  1. Type wp-print in the Keyword search box.
  2. Click on the Install Now button on the WP-Print plugin listing and, once it is installed, - on the Activate button.

02 search wp print plugin

The next step is to make these links appear on your posts/pages.

Insert Printer-Friendly Links Manually

  • The most straightforward way to enable a printer-friendly version of a single WordPress blog post or page is simply to insert the [print_link] tag inside the post or page manually:

03 print link embedded in post

  • The output (for a post) will look like this:

04 print link at front end

Enable Printer-Friendly Links Automatically

What if you would like all of your WordPress blog posts and pages have a printer-friendly version? To do this, you'll have to get under the hood and do some coding customisation. 

  • Open wp-content/themes/YOUR THEME NAME/index.php (you may also open your single.php, post.php, page.php or theloop.php files, if they exist in your theme).

1 Find the following code:

while (have_posts() ) : the_post();

2 Add anywhere below It:

 if(function_exists('wp_print')) { print_link(); }

05 code to insert

  • The first value is the text for printing post.
  • The second value is the text for printing page.
  • In your posts front end list, at the top of every post heading, you will now see the Pint This Post link with a small printer icon:

06 print link front end

  • If you would like to change the Print This Post text to your own liking, go to Settings >> Print:

07 settings print

  • You will see the Print Options admin page. Enter you own text into the Print Test Link for Post and Print Text Link for Page fields:

08 fields with text

Final Step - Regenerate Your Blog Permalinks

For all the above changes to work, you need to regenerate your blog permalinks.

  • In your WordPress dashboard go to Settings >> Permalinks and simply click on the Save Changes button:

09 regenerating permalinks

  • Now go to your blog front end and click on the Print This Post link for one of the listed posts. You will now see the printer-friendly version of the post, with the Click here to print link:

10 printer friendly version

Hiding Some Text from Printing 

In some situations, you may wish to hide some text in a post or page from printing. 

  • Place such text between the [donotprint] and [/donotprint] tags. It won't get displayed for the post or page printer friendly versions.
  • However, it will still be displayed as normal on a normal post or page view.
  • Do note that if you are using WP-Email, any text within [donotprint] and [/donotprint] tags will not be emailed.
Subscribe to OSTraining Video Club and right away start learning how to build superb WordPress websites. Follow our step by step bite-sized video tutorials from only $6 per month!

About the author

Rod holds two masters degrees and has been training people how to do "things" for over 25 years. Originally from Australia, he grew up in Canada and now resides just outside Cincinnati, Ohio.