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: