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.