There are times when it would be nice to turn ANY element into an external print trigger. This is a feature often asked for when trying to hook up a Visual Editor button to be a print trigger. As of Print-Pro-Matic v 1.1.4e we have added:
new printme_trigger class that turns anything into a print trigger
new external_trigger shortcode element to enter the id or ids of the element(s) that should be used as an external trigger
And this is how it works:
First we need an element that has a unique id. There must also be the ability to add the printme_trigger class to it.
And that’s it! Note: The external_trigger attribute can accept a comma separated list of multiple id’s. Also: When an external_trigger attribute is assigned, no standard print-pro-matic icon or text will be displayed, as the external trigger will be used instead.
Normally when a shortcode is used, it would trigger the WordPress magic that makes a shortcode a short code:
Now, if we wanted to show what shortcode was used to make that magic happen, we simply need to escape it like so:
and that renders:
we can even wrap it in a nice code tag to set it apart: [expand title="trigger"]content[/expand]
so far so good.
Now lets say we want to escape a bit of HTML! Well, lets first try simply wrapping it in the code tag:
Hmm… no good. All that seems to have done is render the HTML in the special css of a code tag.
What about using Markdown! Let’s wrap the HTML in backticks and see what happens…