How can i hide specific div with css

WordPress
24 January, 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
24 January, 2022 08:02:35
E2Pdf
Support
Topics: 7
Messages: 3330
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!
24 January, 2022 09:25:27
E2Pdf
Support
Topics: 7
Messages: 3330
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!