Archived topic
Custom Class Names for PrintFriendly plugin
5 replies · Started by Ethan on June 2, 2021
Good Morning-
I have been developing a website using the PrintFriendly plugin and have run into some hiccups with PF and my SEO plugin. I need to add what is a "print-no" class: https://support.printfriendly.com/button/developer-questions/include-exclude-content/
The instructions from their site are to "Simply add the the following class names to your HTML template to take use the features." This does not seem like a simple task. What theme file should I add these custom class codes to?
Any help appreciated. Thanks.
-ethan
Hi there,
it will depend on what you're trying to apply the class to.
Is the content you're wanting to add a class to part of your post content ie. added via the post editor ? Or is it a theme element such as the Site Header or Sidebar ( as thats a lot more complicated ).
Hi David-
I am uncertain how complex an issue this is. So far, working with PrintFriendly has been all css.
Here is the trouble that is occuring:
When printing from my products pages > https://testing.customcoatinginnovations.com/product/klap25ke-body-ext/ > Click the "Print/PDF" icon > There seems to be two "titles" for the product. What I am trying to do is add a "print-no" class to bottom product title. Example html: """<h1 class="product_title entry-title print-no" data-pf_style_display="block" data-pf_style_visibility="visible"><span class="text-node">KLAP25KE | Kit</span></h1>"""
Where should I make the adjustments to add this class? I another "work-around" that involves my Product SEO Settings where I can adjust the Meta-Title if this becomes more involved than expected.
Thanks for the guidance.
-ethan
Hi Ethan,
You may have to create a child theme template for this as this is generated by WooCommerce plugin and I don't think they have a filter for it as shown here - https://github.com/woocommerce/woocommerce/blob/b19500728b4b292562afb65eb3a0c0f50d5859de/templates/single-product/title.php
You'll need a template so you can modify the
the_title( '<h1 class="product_title entry-title">', '</h1>' );
to
the_title( '<h1 class="product_title entry-title print-no">', '</h1>' );
Thank you Elvin.
This was the file I was looking for. Being that this is out of the GeneratePress 'realm' I appreciate the follow up. Problem resolved.
Nice one. No problem. Always glad to be of any help. :)