WP Print Friendly for WordPress
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.
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
Brian,
Version 0.4 includes this option.
Erick
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
Version 0.4 may fix this problem. If not, please let me know as it may indicate incompatibilities with international versions of WordPress.
Erick
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 ?
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 itwpf.php, and WordPress will load it for your theme.Erick
Hi Erick,
There is any short code for this plugin.
Thanks / AA
This plugin doesn’t currently have a shortcode, though I may add one in a future release if sufficient user demand for it exists.
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
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
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.
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
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.
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
Fantastic! I look forward to the update.
Jodi
Same problem as Dan. I want it in my custom post type. I’m using version 0.4.3.3.
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
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!
Simon,
I’ll add this to a future release.
Erick
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
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
Hi
Is there any function to print the content of subpages one u click the print icon from parent page.
Kalpana,
Currently, this isn’t supported. I’ll explore adding that ability to a future release.
Erick
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?
Amy,
Currently, this isn’t possible. I’ll add a shortcode to a future release that will add this capability.
Erick
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
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
Jodi,
Version 0.4.4, released this afternoon, introduces full child theme support.
Erick
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.
thanks for the plugin. I like it’s simplicity.
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!
Marie,
Your theme is using
the_content()on the homepage, rather thanthe_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
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
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
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%”
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
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?