How can i hide specific div with css

WordPress
January 24, 2022 07:55:23
Topics: 3
Messages: 11
Hi,
in my wordpress content i have a special div which i dont want to be part of the pdf. How can i hide it in the pdf?
Thanks
January 24, 2022 08:02:35
E2Pdf
Topics: 7
Messages: 3614
Support
Hi,

Unfortunately CSS display: none currently doesn't supported, but we hope this feature will be available soon.

As a meanwhile solution:

If you need just to hide some content from specified post you can edit post content and exclude the content by adding as:

[e2pdf-exclude]content which must not be printed inside PDF[/e2pdf-exclude]

If it will not fit your needs or you have this div on all posts you can try to build preg_replace filter which will remove content with needed class or id but we need to understand if your div has any identifiers like "class" or "id" to prepare example.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
January 24, 2022 09:25:27
E2Pdf
Topics: 7
Messages: 3614
Support
You can try to apply current construction to remove needed div:

Here is the simple regex example:

/<div class="classname">(.*?)<\/div>/is

It must be placed in Preg Replace Filter. Screenshot attached. If your div has another "classes" or different structure or "divs" inside it regex must be updated to match the value.

We remain at your service.


We would really appreciate your feedback at WordPress.org!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.