- This topic has 14 replies, 2 voices, and was last updated 2 years, 1 month ago by David.
-
AuthorPosts
-
August 5, 2019 at 4:21 am #975975Michael
Hey there,
My scenario: I created a reusable Gutenberg block (a separator with some svg content).
Now I want to add that reusable block with a hook so the separator also displays on archive and single post pages.But how can I achieve that with the Elements > Hook Settings?
What I don´t get is how I can “print” in or add the reusable block via function in a clean way.Do you have a hint in the right direction?
Thank you.
Best regards
MikeAugust 5, 2019 at 5:31 am #976014DavidStaffCustomer SupportHi there,
as the Re-usable block is a post type then you can try this:
<?php // get reusable gutenberg block: $get_block = get_post( XXXX ); echo apply_filters( 'the_content', $get_block->post_content ); ?>
Replace
XXXX
with the ID of the re-usable block.However, this will not load dynamic CSS styles – fine if its a core block but you may see a loss of styling if 3rd party blocks are used.
August 5, 2019 at 5:57 am #976034MichaelHi David,
awesome. That worked.
Thank you very much!
Best regards
MikeAugust 5, 2019 at 6:06 am #976041DavidStaffCustomer SupportGreat! – glad to be of help
March 25, 2020 at 6:57 am #1209484GeorgeSorry for reopening the thread. I have tried the solution using GenerateBlocks that have been converted to reusable blocks but the whole layout and styling have disappeared. I guess it’s what you mentioned, David. Is there going to be a solution to this for GB?
March 25, 2020 at 7:01 am #1209489DavidStaffCustomer SupportUnfortunately that method only works with blocks where inline styles or static stylesheets are used. There isn’t a simple solution to getting the dynamic CSS GB uses, but we are working on something in GP to resolve that.
March 25, 2020 at 7:05 am #1209496GeorgeOh, that’s great, thanks!
March 25, 2020 at 7:07 am #1209501DavidStaffCustomer SupportYou’re welcome
May 30, 2020 at 2:33 am #1307390MarcelHello.
Unfortunately that method only works with blocks where inline styles or static stylesheets are used. There isn’t a simple solution to getting the dynamic CSS GB uses, but we are working on something in GP to resolve that.
Do you have some news about this solution? It would be great to hear a positive answer or at least an estimative deadline for that. Getting the dynamic CSS GB uses would be steroids for designers.
Thank you!May 30, 2020 at 6:13 am #1307528DavidStaffCustomer SupportHi there,
it will be a primary feature in GP Premium 1.11. No definitive time line on that update but i would expect in the next couple of months.
February 25, 2022 at 9:32 am #2133649AlfonsoHi there,
Im trying to get this but is not working for me.
Frontend result:
February 25, 2022 at 9:42 am #2133655DavidStaffCustomer SupportHi there,
you need to check Execute PHP when adding PHP to a Hook element.
February 25, 2022 at 9:53 am #2133670AlfonsoThanks!
February 25, 2022 at 10:05 am #2133686AlfonsoAny more question, please.
I’ve made new Custom Post Type with Jet Engine plugin.
So, how i can custom the archive page from my new Custom Post Type in Generate Press with Gutenberg??
With Elementor is possible, but, in Gutenberg with GeneratePress?
February 25, 2022 at 10:07 am #2133689DavidStaffCustomer SupportCan you raise a new topic for this question.
-
AuthorPosts
- You must be logged in to reply to this topic.