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…
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.
We can use the form and on click event :
This is the source code for the above thing :
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.