Import custom blocks into another page programmatically
Hi,
I like your plugin very much and am considering to go "Pro" with it and switch to it from Elementor Pro. But I have a problem to setup a custom workflow. I need to import custom Brizy blocks into the header.php which is not built by Brizy but written by myself (using PHP/HTML, CSS and JS). But I couldn't find any global functions or an API for theme developers. So I've created a test page with a single custom block, which is just a slim bar:
But when I import it in my header via
get_post_field('post_content', $test_page_id)
I can get the content but not all of the styling, which is partly inserted in HTML in the head tag when loading the test page normally. But when loading only the post content, the styling isn't complete:
Is it somehow possible to get Brizy blocks/posts imported elsewhere programmatically?
Thank you in advance.
-
Hi,
Unfortunately, at the moment isn't possible to display Brizy header, footer or other Brizy blocks in non-Brizy pages. Thet can be displayed only in the Brizy pages.
I also want to add that we are working to improve this aspect and make them available for non-Brizy pages too. It is added to our internal list and our team are investigating it.
Thanks!
Best regards,
Sandra0 -
Hi Sandra,
thank you for your answer. But I might have used wrong terminology. Right now I don't need to import Brizy blocks but to import posts/pages built with Brizy into another pages/posts. So it's from my perspective still kind of a block but from your perspective it would be page/post built with Brizy. Does this change anything? :)
0 -
Hi,
Thank you for these details. If I correctly understand do you want to add in the Brizy pages, a block created by yourself. Unfortunately, vice versa isn't possible at the moment too. If you want to use non-Brizy code on Brizy pages, we can recommend adding the code of the block in the Brizy embed element or shortcode (regarding the structure of the code). Or, if the code is added to the theme and it is displayed with the theme header, you can use the Default page template instead of the Brizy template https://jmp.sh/K8bv1Ma.
Best regards,
Sandra0 -
Hi Sandra,
no, I mean that I need to import a page built with Brizy into another non-Brizy page via PHP. But when I do this by getting the content of the page built with Brizy I am missing some styles as shown in the first post.
0 -
Hi,
Ahh ok, I understand correctly from the first but maybe I didn't express myself correctly. I'm sorry but at the moment isn't possible to import the Brizy page/block or code into a non-Brizy page. The Brizy libraries, code and CSS can work only inside the Brizy builder.
Best regards,
Sandra0 -
Hi Sandra,
now I understand. Bummer. Thank you anyway.
0 -
Hi,
Thank you too! Let us know if we can help you with something else.
Best regards,
Sandra0
Please sign in to leave a comment.
Comments
7 comments