How to add a ‘Print this article’ option in a WordPress blog?

How to add a 'Print this article' option in a WordPress blog?

Sometimes I find it really very annoying to print any article using browser’s Print option. It creates so much mess. It prints every thing on the page; all the links, navigation bars, graphics, texts etc even though you just want to print only the article. So here is a solution; it will only print the WordPress article no matter how much graphics, links, navigation bars you have in your main site.

We are going to use WP-Print plugin by Lester ‘GaMerZ’ Chan. Once the plugin is installed, you can find Print option under Settings in your dashboard. This option will allow you to customize the print page layout.

WP-Print will create a printable version of your posts by using its own CSS file, and it will automatically launch the printable page when the user clicks on the “Print this” link that you will insert on your blog.

How to add “Print This” on Your Article

  1. Open wp-content/themes/<YOUR THEME NAME>/index.php
    You may place it in single.php, post.php, page.php or theloop.php also.
  2. Find:
    <?php while (have_posts()) : the_post(); ?>
  3. Add Anywhere Below It:
    <?php if(function_exists('wp_print')) { print_link(); } ?>

    The first value is the text for printing post. The second value is the text for printing page.
    Default: print_link('', ''). Alternatively, you can set the text in WP-Admin -> Settings -> Print.

  4. If you DO NOT want the print link to appear in every post/page, DO NOT use the code above. Just type in [print_link] into the selected post/page content and it will embed the print link into that post/page only.

Please Note

  • If you do not want to print a portion of your post’s content, do the following:

    [donotprint] Text within this tag will not be displayed when printing [/donotprint]

    The text within [donotprint][/donotprint] will not be displayed when you are viewing a printer friendly version of a post or page. 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] [/donotprint] will not be emailed as well.

  • WP-Print will load print-css.css, print-posts.php and print-comments.php from your theme’s directory if it exists.
    • If it doesn’t exists, it will just load the respective default file that comes with WP-Print.
    • This will allow you to upgrade WP-Print without worrying about overwriting your printing styles or templates that you have created.

Final Notes

Check out the article image. You can customize the plugin in different ways with Share this article, Rate this article, Email this article etc. Share your views on the article and let me know if you need further assistance.

Take care, bye.

By | On Saturday, July 31st, 2010 | Under How To's, Plugins | 1 Comment »


Contact our experts, most of the time we assist our readers free of charge.

Those who found this page were searching for:

  • wordpress + print page content
  • text only print wordpress
  • WP Print Friendly wont stay off of pages
  • wp print only post
  • wordpress article print
  • wordpress print article
  • print only content wordpress
  • how to add print option in each post in wordpress
  • code for print option wordpress
  • print article

Previous post:

Next post: