Creating Printer-Friendly Versions of WordPress Posts and Pages

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:

{codecitation}while (have_posts() ) : the_post();{/codecitation}

2 Add anywhere below It:

{codecitation} if(function_exists(‘wp_print’)) { print_link(); }{/codecitation}

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.

{snippet subscribe-video-club-ad}

Instructor

  • 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. He has worked in both the non-profit and for-profit worlds, in small companies and large corporations. His extensive open source experience includes WordPress, Joomla, Drupal and Moodle and he really knows how to help you get the most out of the system you chose. Rod plays ice hockey a couple of times a week and rides his Goldwing motorcycle pretty much everywhere he can.

0 0 votes
Blog Rating
Subscribe
Notify of
7 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
mguzzetta

When I click on the Print-Friendly link I put on one of my articles, it goes to a very ugly page that has way too much information about every link on that page. If I click on the little print icon that shows up on that ugly page, it takes me to the wording of my article on [url=http://printfriendly.com]printfriendly.com[/url] where I can click and print. Is that how it’s supposed to work? I think it would confuse my users.

Raju

Nicely explained

Mahen Patil

But using this shortcode and plugin it gives print of the the code not designing part.

if you use this for post then it shows code of single.php file which is available in wordpress current theme folder.

alex-smirnov

Hi Mahen.
Apology, but in our tutorial we missed important point on regenerating permalinks. I added it now, so please read the post once again to get the whole picture this time.
In my testing, I was able to see the print-only version of my post only after I went to Settings -> Permalinks and clicked on Save Changes.
Hope this will help you too.
Regards,
Alex

Stephanie

I have one specific page on my site I am trying to get to print without anything around it (the menu, logo, footer, etc.). I installed the plugin, did all of your steps, have the print page logo and link. When clicked it opens the page on another screen correctly, but it still includes the url of my site, the name of the page at the top (even though I’ve hidden it), Posted by.. the date, time, etc. In in Settings, Print, I’ve put all the options to No. I don’t see anyplace else to get rid of this text. Is this possible? I would like it to just print cleanly the contents of my page with nothing else around it. Thanks!

Paul

Thank you for the guidance.

MD Mahabub Hasan

Thanks for sharing this article .

7
0
Would love your thoughts, please comment.x
()
x