WP Print Friendly  for

Extends WordPress’ template system to support printer-friendly templates for posts, pages, and custom post types. Uses WP standard template naming to support templates on a post-type basis. Supports printing paged posts on single page. Adds nice URLs for printer-friendly pages.

The plugin comes bundled with a basic print template that will likely suit many needs.

To take advantage of its templating capabilities, add a file named wpf.php to your theme. From there, you can use any existing WordPress functions to generate your print view. To create a custom print template for your homepage, add wpf-home.php to your theme. From there, standard WordPress template naming conventions are followed, so wpf-[custom post type name].php or wpf-[custom taxonomy name].php would be invoked for your custom post type and custom taxonomy, respectively.

To add a print link to your templates, you can either let the plugin add it automatically via the settings available under Options > WP Print Friendly, or you can use this function: wpf_the_print_link( $page_link, $link_text, $class, $page_link_separator, $page_link_text );. The optional parameters are as follows:

  • $page_link: Set to true to include a link to the current page of a paged post. To exclude this link, set to false.
  • $link_text: Sets the text for the print link for the post’s full content. Defaults to “Print this post.”
  • $class: CSS class for the print links. Defaults to “print_link.”
  • $page_link_separator: Specifies how the full-post and page-specific print links should be separated. Defaults to ” | “.
  • $page_link_text: Sets the text for the page-specific print link. Defaults to “Print this page.”
  • $link_target: If set to “new”, print links will open in a new window.

106 Thoughts Contributed to “WP Print Friendly”

  1. Brian - August 5, 2011 at 10:38 am Reply

    Erick,

    Could you please tell me how to disable printing the end notes, or better yet can you add this as an option in the settings?

    Thanks,
    Brian

    • Erick Hitter
      Erick Hitter - August 13, 2011 at 7:39 pm

      Brian,

      Version 0.4 includes this option.

      Erick

  2. Merav - August 10, 2011 at 3:44 am Reply

    Hi,

    A while ago I installed the plugin and it worked jusr fine.
    for some reason it stopped working about a week ago.
    I tried to deactivate and activate again, the links apear but when clicking it doesn’t redirect to the printing preview (i’m using the default template).
    link to the site: http://tiulim.net/
    Please help me fix this,

    Thanks,

    Merav

    • Erick Hitter
      Erick Hitter - August 13, 2011 at 8:10 pm

      Version 0.4 may fix this problem. If not, please let me know as it may indicate incompatibilities with international versions of WordPress.

      Erick

  3. Cyril - August 11, 2011 at 3:24 pm Reply

    Hi,

    Look here : plugins/wp-print-friendly/wp-print-friendly.php and comment line 294 and goodbye endnotes ;)

    Are there any templates examples with this plugin ?

    • Erick Hitter
      Erick Hitter - August 13, 2011 at 8:06 pm

      Cyril,

      Version 0.4 provides an option to disable endnotes.

      Included with the plugin is default-template.php, which is used by the plugin if your theme doesn’t have an overriding template. You can copy that file to your theme, rename it wpf.php, and WordPress will load it for your theme.

      Erick

  4. aashu - August 24, 2011 at 6:12 am Reply

    Hi Erick,

    There is any short code for this plugin.

    Thanks / AA

    • Erick Hitter
      Erick Hitter - August 24, 2011 at 8:45 am

      This plugin doesn’t currently have a shortcode, though I may add one in a future release if sufficient user demand for it exists.

  5. Leonardo - August 26, 2011 at 4:51 pm Reply

    Hi! I’ve just installed wpf and got the links generated (something like that: http://www.mywpsite.com/?p=1607&print=0). But when I click this link, the browser shows a new window (ok, this is right according to my settings) but the new window shows exactly the same content of the previous one which I clicked the generated link. I have this line in ‘single.php’ of my template: . What can be wrong?

    Thanks in advance.

    Leonardo

    • Erick Hitter
      Erick Hitter - September 3, 2011 at 10:00 am

      Leonardo,

      After activating the plugin, did you go to Options > Permalinks and click Save Changes? If not, please do so as this should correct the problem.

      If the problem persists, are you using any SEO plugins? Some, such as WordPress SEO by Yoast, can interfere with the plugin.

      Erick

  6. Dmitry - September 8, 2011 at 8:03 am Reply

    Very nice plugin, Eric, but there is one thing- I run multilang site, so i’d like to have you plugin with textdomain. I think having text-tomain and therefore translation readiness will help you gain more users. In my turm i’ll translate it to russian and serbian free of charge should you provide text-domain version.
    Best,
    Dmitry.

    • Erick Hitter
      Erick Hitter - September 8, 2011 at 8:14 am

      Dmitry,

      The plugin is already translation-ready; its text domain is wp_print_friendly. I can also provide a .pot file if you’d like.

      Erick

  7. Jodi - September 14, 2011 at 3:23 pm Reply

    Thanks for the great plug-in!

    One question: I am having trouble with the plug-in locating my wpf.php file in my child theme. Just to make sure that everything else was working properly, I moved the wpf.php file into the plug-in folder and temporarily changed the code in wp-print-friendly.php to (changing TEMPLATEPATH to $pluginpath):

    elseif( file_exists( $pluginpath . ‘/wpf.php’ ) )
    $template = array(
    ‘name’ => ‘wpf-default’,
    ‘path’ => $pluginpath . ‘/wpf.php’

    I was then able to add and remove content in my printable output using wpf.php. What I don’t understand is that, for some reason, “TEMPLATEPATH” does not lead the plug-in to wpf.php when it is in my template directory. What might I be doing wrong?

    I am working on a WP install on a local machine that is not in the root directory. I wonder if this is part of the problem? I am also using a child theme that I am writing based on twentyten.

    Thanks in advance for your help.

    • Erick Hitter
      Erick Hitter - September 14, 2011 at 3:34 pm

      Jodi,

      As you’ve discovered, the plugin doesn’t properly support child themes because the TEMPLATEPATH constant always refers to the parent theme. I’ve only recently become aware of the problem, but correcting the issue is feasible. I hope to release an update that adds child theme support in the next few weeks.

      Erick

  8. Jodi - September 14, 2011 at 6:00 pm Reply

    Fantastic! I look forward to the update.

    Jodi

  9. Suraj - September 22, 2011 at 3:10 am Reply

    Same problem as Dan. I want it in my custom post type. I’m using version 0.4.3.3.

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 12:57 pm

      Suraj,

      When naming your template, be sure to use the post type name, not the query variable or rewrite slug. The post type name is the first parameter of register_post_type();.

      Erick

  10. simon - September 25, 2011 at 12:32 pm Reply

    hi erick,
    great plugin!
    if you could provide a way of adding ‘title’ info to the link that is created in the plugin itself or as part of the wpf_the_print_link() function that would be cool. I’m using it at the moment substituting an image for the auto created text and would like to be able to add expklanatory title text to the image with out having to hack your plugin and thus lose out when you upgrade to the next version!

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 12:58 pm

      Simon,

      I’ll add this to a future release.

      Erick

  11. Matthias - September 27, 2011 at 3:28 am Reply

    Hi Erick,

    i installed the plugin, the print function works well. Only the homepage doesn`t work. If i click “Print” the content of page is not shown in the preview. Can you help me?

    Thanks
    Matthias

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 1:02 pm

      Matthias,

      Does your homepage use a standard WordPress template, or has it been customized heavily? If the latter is true, you will need a custom template as well, named wpf-home.php. My plugin uses the main WordPress query, so if your template includes additional queries or is modified using query_posts();, my plugin has no way of picking up on those customizations.

      Erick

  12. kalpana - October 1, 2011 at 9:30 am Reply

    Hi
    Is there any function to print the content of subpages one u click the print icon from parent page.

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 12:59 pm

      Kalpana,

      Currently, this isn’t supported. I’ll explore adding that ability to a future release.

      Erick

  13. Amy - October 9, 2011 at 10:37 am Reply

    I only want one specific page to have a Print the Entry feature. How do I put the code in just the post and not the template for all pages/posts?

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 1:00 pm

      Amy,

      Currently, this isn’t possible. I’ll add a shortcode to a future release that will add this capability.

      Erick

  14. Jodi - October 18, 2011 at 10:53 pm Reply

    Erick,

    Hi again. Any more thoughts about child theme support? I’m currently using the workaround I described before, but was curious about where things stand for official child theme support.

    Thanks again for creating such a great plug-in!

    -Jodi

    • Erick Hitter
      Erick Hitter - October 20, 2011 at 1:20 pm

      Jodi,

      Official child theme support is planned, we just happen to be rather busy at the moment with client engagements. My intent is to make the necessary changes by the end of the month at the latest.

      Erick

    • Erick Hitter
      Erick Hitter - October 25, 2011 at 12:54 pm

      Jodi,

      Version 0.4.4, released this afternoon, introduces full child theme support.

      Erick

  15. Chelle - October 27, 2011 at 3:42 am Reply

    Just wanted to say thank you for this plugin. I needed something that was SEO friendly and supported pagelinks for posts and this was perfect!

    I did some minor tweaking: added a rel=”nofollow” tag to the print links and integrated it with the fancybox jquery plugin to set it up as an iframe/lightbox – really turned out nice.

  16. Oscar - October 27, 2011 at 7:46 pm Reply

    thanks for the plugin. I like it’s simplicity.

  17. Marie - October 31, 2011 at 2:15 pm Reply

    Hi Erick,

    Thanks for the plugin, it works really well! I only have one question…

    The link “print” appears on the bottom of each pages (that is perfect) but it appears also in the bottom of each preview on my homepage…
    I can see a preview of each post (with approximately 20 words) and a “print” link to each… it looks weird! Can I do something for that?

    Thanks for your help!

    • Erick Hitter
      Erick Hitter - May 29, 2012 at 9:11 pm

      Marie,

      Your theme is using the_content() on the homepage, rather than the_excerpt(), which is why the links appear there as well as on individual posts.

      The plugin doesn’t currently support different settings based on the use of the_content(). To hide the links, you can either use CSS or add the links manually as described in the plugin’s readme.

      Erick

  18. James - November 17, 2011 at 10:14 am Reply

    Erick,

    I am not a coder, and I am trying to figure out how to add a print link on a single page, not all of the pages in the site. I have had a hard time understanding exactly what I am supposed to do. Can you please help me?

    Thanks,

    James

    • Erick Hitter
      Erick Hitter - May 29, 2012 at 9:13 pm

      James,

      Basically, you need to add wpf_the_print_link() to the page template where you’d like the link to appear. The plugin’s readme details what arguments this function accepts.

      Erick

  19. Josh McCoy - December 29, 2011 at 9:55 am Reply

    Hey Erick, I’m using “Reveal Theme” from Theme Trust. It may have some SEO stuff inside, but I do all mine manually.

    Here is what I have: “/%postname%”

    • Erick Hitter
      Erick Hitter - January 5, 2012 at 7:20 am

      Josh,

      The problem turns out to be related to your permalink structure. For some reason I haven’t yet identified, the lack of a trailing slash prevents WordPress from properly interpreting the print URLs. By simply adding a slash to the end of the permalink structure (/%postname%/), the print URLs work properly. I need to research where the cause of this problem lies, as the handling of permalinks using this structure changed substantially in WordPress 3.3.

      Thank you for bringing this problem to my attention,

      Erick

  20. Josh McCoy - January 30, 2012 at 11:58 am Reply

    Erick,

    I am not using an SEO plugin at all. Hmm… So you say to put the slash on the very end of my permalinks and it will work? Even in custom post types?

What do you think?

(required)

Oomph is a full-service digital agency providing strategy, design & development and a host of other web services. A leader in WordPress and Drupal implementation, Oomph pushes the boundaries of today’s web platforms. Oomph has a diverse portfolio of non-profits, international corporations and publications. Team Oomph is always thinking creatively about the digital world. Oomph is located in Providence and Boston.