- This topic has 9 replies, 4 voices, and was last updated 9 months, 1 week ago by
David.
-
AuthorPosts
-
August 5, 2019 at 4:21 am #975975
Michael
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 #976014David
StaffCustomer 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 5, 2019 at 5:57 am #976034Michael
Hi David,
awesome. That worked.
Thank you very much!
Best regards
MikeAugust 5, 2019 at 6:06 am #976041David
StaffCustomer SupportGreat! – glad to be of help
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 25, 2020 at 6:57 am #1209484George
Sorry 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 #1209489David
StaffCustomer 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 25, 2020 at 7:05 am #1209496George
Oh, that’s great, thanks!
March 25, 2020 at 7:07 am #1209501David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 30, 2020 at 2:33 am #1307390Marcel
Hello.
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 #1307528David
StaffCustomer 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.