Home / Blog / Wordpress Tutorials / Creating Printer-friendly Versions of Wordpress Posts 
Alledia.com Blog
Feb
07
2010
Creating Printer-friendly Versions of Wordpress Posts
Wordpress Tutorials
Written by Open Source Training   
Avatar

How to Add Printer-friendly Versions of Your Wordpress Posts

  • Step 1: Click here to download the latest version of "WP-Print". Click the orange "Download" button in the top-right corner..
  • Step 2: Extract the files into a folder on your desktop. The folder will be called, unsurprisingly "wp-print"
  • Step 3: Login to your site's files via FTP and navigate to /wp-content/plugins/.
  • Step 4: Upload the "wp-print" folder to  /wp-content/plugins/.
  • Step 5: Go to wp-admin >> Plugins and click "Activate" under "WP-Print"
  • Activate WP Print

The next step is to make these links appear on your posts:

Enabling the Printer-friendly Links - Easy

The most straightforward way to enable the Printer-friendly Version is simply to add this to each post anywhere you like: [print_link]

The output will look like this:

Wordpress Printer-friendly Version

Enabling the Printer-friendly Links - Code

If you're feeling confident with your ability to edit Wordpress themes files there are instructions from the developer at LesterChan.net (click the usage tab) on how to modify your theme to automatically include the print button on every post:

  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(); } ?>

    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.

    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. Go to 'WP-Admin -> Settings -> Print' to configure the style of the print text link.
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 defalult 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.

    Click here to read the original tutorial on Open Source Training.

    Free Weekly Wordpress Tutorials

    Every week we send out a Wordpress tutorial. One topic. Simple step-by-step instructions. The newsletter is completely free. Sign-up below for free weekly Wordpress how-tos in your inbox:

     

    Comments  

     
    #1 Victor Drover 2010-02-08 13:42
    I've been using WP-print since my first WP site on v2.2.1. It still works great, though it creates a duplicate URL (/print) for each article. What's you're thought on tradeing off duplicate URL penalties (do they still exist???) vs the print functionality.
    Quote
     
     
    #2 Robert Vining 2010-02-09 17:46
    Just a heads up, the link in the tutorial for download links to the XML Sitemap Generator plugin for WP, not the Print Plugin.

    Thanks for the tutorial!
    Quote
     
     
    #3 Steve Burge 2010-02-10 18:48
    Cheers Robert - fixed now.

    Vic - I think the module should be probably be made to add no-follow to its links if you care about SEO.

    We used to have a serious case of the same problem in Joomla 1.0.
    Quote
     

    Add comment


    Security code
    Refresh