As of print-o-matic version 2.0.1 the ability to use class to target a print element in external print triggers has been added. Basically it works the same as using the data-print_target attribute but instead uses a unique classname in the format of printtarget-<target_id>.
Step 1
Create a target element. The element below is a div with an id of ‘my_print_target’:
<div id="my_print_target">This is the print target wrapped in a div with an element of 'my_print_target' as explained above</div>
This is the print target wrapped in a div with an element of ‘my_print_target’ as explained above
Step 2
Add an external trigger using the new class-trigger method. We’ll use a simple button like so:
Like in the original example, we need to add the hidden print trigger using a print-me shortcode with the same id as our external trigger and a printstyle=”external” attribute:
The following CSS can be used to control the vertical spacing between the three components. So that we don’t adjust all expand elements, the first step is to provide a unique class for each component:
To accomplish this, first the Add rewrite rules must be checked on the Archive-Pro-Matic settings page:
After the CPT Rewrite Rules has been checked and saved. It might be necessary to flush the rewrite rules by simply navigating to: Dashboard > Settings > Permalinks – do nothing, and re-save the permalink settings.
Second a custom url rewrite function must be added to the child-theme’s function.php file. This function uses a new filter that has been added to manually overwrite the url that archive-pro-matic uses:
In this example, the option to include a specific element is provide by using a checkbox. This feature was introduced in Print-Pro-Matic version 2.0-beta-210121
This is a Donkey
The default print target will be the article element. The image of the donkey has been assigned a class of ‘logo’. Now we need to create our print trigger and a checkbox:
The checkbox must have an ID of ppm_odnp (because print-pro-matic optional do not print is a bit long). The value is the optional do not print selector, so .logo is for items with a class of ‘logo’, while #logo is an item with an id of ‘logo’.