0

I have an Elementor page and I need to get the HTML and CSS output of it without the header and footer to use in an email plugin I am making. Is there a function in WordPress that can do this? I've read about WP_Post but there is no method to get the content of it. WP_Post->content (actually get_post($post)->content) doesn't return anything.

2
  • 1
    Probably not. It depends how Elementor works. But that's generally not how WordPress pages are structured. You would need to build your theme with this use case in mind from the beginning. Regardless, third party plugins are off topic, so I recommend asking in an Elementor focused forum. Jan 5, 2022 at 12:16
  • Can't a static site generator make only one page?
    – Maytha8
    Jan 6, 2022 at 1:07

1 Answer 1

0

You do not have any function to get the html+css+content of a page for the reason the HTML and CSS is provided by the Theme and the content is stored in the DB.

About Elementor, I don't know exactly how blocks are stored but CSS is in memory created in a physical file.

You can get the content through the_content filter hook https://developer.wordpress.org/reference/hooks/the_content/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.