Print-O-Matic | Documentation
Shortcode Attributes
Shortcode Attributes
Print-O-Matic uses the [print-me]
shortcode to place the print trigger on any post or page. The following shortcode attributes controls the look and the function of the print trigger.
By default the target element to be printed is article
. This can be changed by assigning a valid HTML Element, Class, or ID.
[print-me target="body"/]
[print-me target=".element_class_to_print"/]
[print-me target="#element_id_to_print"/]
Multiple targets can be assigned using a comma to separate each target element. For example, let’s say we wanted to target two elements, one with an ID of elem1
and another element with a class of elem2
.
[print-me target="#elem1, .elem2"/]
The Title attribute is used to modify the print trigger text link. Also, if no alt attribute is assigned, the title attribute value will be also be used as the rollover text of the printer-icon (if used).
[print-me title="Print Form"/]
The ID attribute will assign the print trigger a specific ID.
[print-me id="my_custom_id"/]
If no ID attribute is defined, a random, unique ID will be automatically assigned.
By default a print icon will be displayed. A text-only link may be used by setting the printicon attribute
to false.
[print-me printicon="false"/]
Defines which print icon should be used. If the printicon attribute is not set to false, a default print icon will be used. The following alternative printer icons may be assigned:
[print-me printstyle="pom-small"/]
[print-me printstyle="pom-small-black"/]
[print-me printstyle="pom-small-grey"/]
[print-me printstyle="pom-small-white"/]
if inserting the shortcode for an external trigger:
[print-me printstyle="external"/]
The optional class attribute is used to add a specific class to the print-me trigger element.
[print-me class="my_custom_class"/]
Placeholders allow for targets to be defined dynamically based on post id or position in the DOM.
%ID%
may be used to automatically insert the post ID to be used in the target
[print-me target="#post-%ID%"/]
Use %prev%
and %next%
to print elements immediately preceding or following the print-me shortcode.
[print-me target="%prev%"/]
[print-me target="%next%"/]
Assigning the url attribute the %print_view%
placeholder opens a new tab with a print_view query value that can be used to trigger the use of a custom print template.
[print-me url="%print_view%"/]
Values can assigned to the print_view query var using:
[print-me url="%print_view=val%"/]
A sample_print-template.php file has been included in the Print-Pro-Matic folder for reference.
The optional tag attribute is used to change the html element that wraps the print-me trigger element.
[print-me tag="span"/]
If no tag attribute is defined, a DIV element is used by default.
The Alt attribute will override any rollover text for both the printer-icon and the title link.
[print-me alt="Click me to print"/]
Custom HTML to be added to the top of the print page.
[print-me html_top="<p>HTML content to be placed at the <em>top</em> of the printed page</p>"/]
Custom HTML to be added to the bottom of the print page.
[print-me html_bottom="<p>HTML content to be placed at the <em>bottom</em> of the printed page</p>"/]
Use the do_not_print attribute to prevent content elements inside the target container from being printed. The following code would display but not print any elements assigned a class of “noprint”.
[print-me do_not_print=".noprint"/]
The pause_before_print attribute will pause triggering the print dialogue, allowing time for the print-page to fully load. Simply set the amount of time in milliseconds.
[print-me pause_before_print="3000"/]
The above code will cause the print page to wait 3 seconds (3000 milliseconds) before triggering the print dialogue box.
Examples of Print-O-Matic and Print-Pro-Matic that demonstrate different ways the plugins can be used are available on our SpaceDonkey test server.