Skip Navigation

[Resolved] Add custom class to base64 encoded style for div used in Blocks/View

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 1 voice.

Last updated by timP-5 3 years, 2 months ago.

Author
Posts
#2208485

I have a toolset CPT, outputted to a content template containing nested view loops (it works beautifully, thanks to Christian's previous support). I added styles to the blocks used in the loops. Per a previous ticket I found on your site (see Reply #1869447 at https://toolset.com/forums/topic/how-to-get-rid-of-base64-encoded-style/#post-1869447), I learned that these custom block styles are encoded in a base64 string, decoded upon display using JS, and results in two HTML entries:

<div class="tces-js-style-encoded" style="display:none;">QG1lZGlhIG...</div><script class="tces-js-style-to-head">toolsetCommonEs.styleToHead()</script>

There are no issues with this - everything works as it should.

But now, I want to print the View to a PDF (yes, a royal pain, but...it's been requested of me). I found that Print, PDF, Email by PrintFriendly plugin works surprisingly well, out of the box (see https://wordpress.org/plugins/printfriendly/).

Now, when I click to view the PDF output, even though the <div class="tces-js-style-encoded">...</div> base64 encoding has a style to display:none; (this works on the front end view), the PrintFriendly plugin prints the base64 string to its output.

Their plugin has a few classes that will prevent select content from being printed (see hidden link), one of which is class="print-no". When appended to an element, like a div, the API conversion utility passes over any element with this class, and it is not outputted to the print. I've tested this with the "back to top" entries in my loop and it works perfectly.

So, finally to my question: where do I look within the Toolset plugin files to find where I might be able to add {class="no-print"} to whatever is generating the base64 encoded div I mentioned above? In other words, it should be possible to add this class directly to the file where <div class="tces-js-style-encoded" style="display:none;">QG1lZGlhIG...</div> is generated, to be <div class="tces-js-style-encoded" style="display:none;" class="print-no">QG1lZGlhIG...</div>

You can see what I'm talking about by looking at this page hidden link and clicking the Print/PDF icons toward the top right of the header of the view. Look at the output and just before the "President's Message" (the start of the view loop) you'll see their plugin grabs the two base64 encoded styles and prints them. If I can add the class="print-no" to those divs, I suspect it will fix the problem.

I understand working in child themes and all that, so I'm really looking for advice on where the file is within the plugin that generates the code mentioned above, and what the syntax would be to add a class.

I am hoping doing as I have requested won't have any effect on the function of blocks or the view (it shouldn't since the class print-no should be ignored, right?)

Thank you so much!
Tim

#2208547

Good News! By inspecting the source on the page where I display the view, I gleaned a path to find the appropriate PHP file that generates the div: public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/common-es/server/Block/Style.

Tenacity wins! Thank you!

TIm

#2208549

My issue is resolved now. Thank you!