Add a Print Button in Genesis powered WordPress website in just few steps. You really need not to be a coding expert – its amazingly easy than you can think. Basically I forgot to write this trick before (someone requested via comments). Anyway, the basic logic behind to add a Print Button in Genesis powered WordPress website is nothing but using our age old HTML, Javascript etcetera tricks. In old days, it was quite common to add a Print this webpage link as basically access to Internet was a bit difficult that it is now, users needed a hard copy, may be Print Media thought to be the standard. I precisely can not recall when it has went away from 95% websites, but possibly its WordPress who indirectly abolished it. It was by default present in older forum softwares too. We published a kind of list before for offering PDF file download by using WordPress Plugin, if you want to give the PDF only option, then this guide to add a Print Button in Genesis Child Themes (or Framework itself) will not for you. All examples are not made active to avoid conflict while rendering the webpage. You can test on your own website.
Add a Print Button in Genesis Powered WordPress Website : The Basics
Almost all of us uses two important Genesis Plugins :
- Genesis – Simple Hooks (Which needs to be updated to fit with HTML5)
- Genesis Print Plus
Basically you can either use the code directly or create a custom shortcode and use via Genesis Simple Hooks plugin. All normal WordPress reference works for Genesis, as you probably know. Obviously, the Genesis Print Plus will create the automated print media CSS file and add the meta tag to header.
---
A bit more idea : You can actually download the CSS once, upload to CDN and delete the plugin. Obviously add the meta as normal HTML meta tag via Genesis’s main admin panel. One plugin is not used means a good amount of compute cycle is saved. Practically we never need a dynamic Print CSS. If this trick is making you dizzy, avoid this “A bit more idea” paragraph. The things will work without this paragraph.
Add a Print Button in Genesis Powered WordPress Website : The Coding Part
As you can see the line of auto generated CSS for Print :
The url is this :
Its minified so it looks bad. You can make it a bit readable – obviously your website’s one, not ours. So, Genesis Print Plus is useless because actually it does 50% work from a view point but from Printer’s view point it serves all the needed work. An auto generated Print CSS actually not much really helpful – it will not help to really not print many custom things, like Ads. Basically a Print should look like a clean document. So you need to work a bit (again optional step).
rel=”print’ should work. So the link will be a normal HTML link with either no rel tag or rel=”print”. Please check the updates in Microformat’s Wiki. Now, what are the options for us…
Javascript :
Basically including this Javascript is enough. Your href will be this :
1 | <span style="color: #800000;">javascript</span>:<span style="color: #ff00ff;">window</span>.print<span style="color: #008000;">()</span> |
So, the complete code will be :
This will give you exactly this thing :
As it is a plain HTML, you can include an image, customize with CSS etc.
HTML and Javascript :
We can use the form and on click event :
This is the source code for the above thing :
Javascript plus HTML5 :
schema.org has no spec still now for Blog plus Print at the time of writing. It has print properties only for News Article. So we need no itemprop markup.
Its obvious that you can use form action for HTML5 too. You can create a small animation and other things which HTML5 supports.
Tagged With how to add a print button to a website on wordpress