Often users want to print articles they find interesting. By default, WordPress itself and most WordPress themes would print your page as it is, with all the graphics, colors, and text in sidebars. In this article, we will show you how to add a printer friendly option to your WordPress posts.
Why and When You Need a Printer Friendly Option for WordPress Posts?
Some WordPress themes come with a separate CSS stylesheet for printing. This stylesheet is used when a user prints a page. Other WordPress themes, may not change your site’s appearance when a user prints it.
Usually, this results in users printing all the images, sidebars, headers, menus, etc. Most of the time it is not very pleasant to read or look at.
You can see how your WordPress theme handles print by pressing CTRL+P when looking at a page from your site. Your browser will show the print preview of your site.
If your theme shows your site as it appears in the browser, then it is not handling print any differently.
In that case, you can use a printer friendly option on your WordPress site. It will not only make your content printer friendly, but it will also encourage users to print with an on-screen print icon.
We will be showing you two plugins that can add a print option to WordPress, and you can choose the one that best suits your need.
Method 1: Add Print Button in WordPress with Print Post and Page Plugin
This method is recommended for users who do not want to add code to their WordPress theme files.
The first thing you need to do is install and activate the Print Post and Page plugin.
Upon activation, the plugin will add a new menu item labeled ‘Print’ to your WordPress admin bar. Clicking on it will take you to the plugin’s settings page.
Here you can choose the print icon size and color, text to accompany the icon, and print alignment. Optionally, you can add custom CSS that you want to include into your print template.
Don’t forget to click on the ‘Save and Activate’ button to store your plugin settings.
You can now visit your WordPress site and you will see a print button on your single posts.
However, the plugin does not automatically add the print button to your WordPress pages. You will need to add [printicon align="left"]
the shortcode to your WordPress pages to display the print icon on pages.
Method 2: Adding a Printer Friendly Option Using WP-Print
The first thing you need to do is install and activate the WP-Print plugin.
Upon activation, you need to visit Settings » Print to configure plugin settings.
You can display the print icon with text, just the icon, or just the text. You can choose between two icons, and you also change the text that appears with the icon.
Under print options, you will be asked if you want to print comments, links, images, or videos. By default, the plugin does not print comments and videos. You can change that if you want the plugin to print comments and videos as well.
At the bottom of each printed post, the plugin will add a disclaimer/copyright text. By default, it will show your site’s name. You can change that to anything you want, and you can also use HTML tags inside the disclaimer field.
Don’t forget to click on the save changes button to store your settings.
Now comes the tricky part. The plugin will not actually add the print button into your posts. You will have to manually edit your WordPress theme files to add the button.
Depending on your theme, you may need to add the code into single.php, page.php, archive.php, content.php, etc.
Locate the line in your theme template that looks like this:
1
|
<?php while (have_posts()) : the_post(); ?> |
Below this line, you need to add the following code where you want to display the print button:
1
|
<?php if (function_exists( 'wp_print' )) { print_link(); } ?> |
That’s all, you can now visit your website and you will be able to see the print button.
Sometimes you may have content that you do not want to be included into the print version. Simply wrap that content between [donotprint]
and [/donotprint]
shortcode, like this:
1
|
[donotprint]This text will not be displayed when printing[/donotprint] |
We hope this article helped you add a printer friendly option to your WordPress posts.