- This topic has 22 replies, 4 voices, and was last updated 3 years, 6 months ago by
Josue.
-
AuthorPosts
-
August 14, 2022 at 5:58 pm #2312871
SLIM
Is there an actual difference to the GenerateBlocks IMAGE block and the default one?
Great find on that plugin btw.
And WHAT FACEBOOK GROUP?August 15, 2022 at 4:21 am #2313233David
StaffCustomer SupportTry:
1. for loading the scripts if the GB image block is on the page:
add_filter( 'baguettebox_enqueue_assets', function ( $enqueue_assets ) { return $enqueue_assets || has_block( 'generateblocks/image' ); } );2. The
baguettebox_selector– this i am unsure of as it believe that is for handling a Gallery not a single image. So i think you can ignore that ? no ?Or you can try targetting the figure wrapper on the GB image (?) ie.
add_filter( 'baguettebox_selector', function( $selector ) { return $selector . ',.gb-block-image'; } );August 15, 2022 at 4:35 am #2313251David
StaffCustomer Support@slim_k – these are our Facebook groups:
https://www.facebook.com/groups/generatepress
https://www.facebook.com/groups/generateblocksDifference between Core and GB Image Block.
They both use the core get attachment functions to display the image.
But GBs block has all the GB Styling controls. So you have far greater stying options in the editor with GB.
The Advanced > Additional CSS Class in GB Image puts the class on the<img>tag, which means adding custom classes for things such as lazyloading can be done more easily.
For in post images, i would generally use the core Image Block. The GB Image block really makes the most sense when you need to break from the theme styles of the core image.August 16, 2022 at 6:07 am #2314400Josue
Thanks David, where is the best place to add this filter?
August 16, 2022 at 6:47 am #2314453David
StaffCustomer SupportThis doc explains:
https://docs.generatepress.com/article/adding-php/
TLDR:
Are you using a Child Theme? IF yes, then it goes in the Child Theme > Functions.php
IF No, then you need the Code Snippets plugin to which you will add it in a New Snippet.August 17, 2022 at 2:48 am #2315355Josue
Hi David,
I use the Code Snippets plugin. I already tested it, and it only works with the second script:
add_filter( 'baguettebox_enqueue_assets', function ( $enqueue_assets ) { return $enqueue_assets || has_block( 'generateblocks/image' ); } );So, after chating a lot with other users in the Facebook page, it seems that the best two solutions are:
1. The Vanilla JS plugin very lightweight: https://wordpress.org/plugins/gallery-block-lightbox/#utm_medium=referral&utm_source=facebook.com&utm_content=social – but we need to use the script above.
2. Another JS plugin also lightweight: https://wordpress.org/plugins/gallery-block-lightbox/#utm_medium=referral&utm_source=facebook.com&utm_content=social
The first one is more lightwegith, but the second one doesn’t need a script. Which one would you guys recommend? – Anyway, both of them work very well, I hope this helps other users who were also looking for one.
September 22, 2022 at 4:44 am #2350469Jesús
You can use “Lightbox for Gallery & Image Block” and add “gallery” or “wp-block-image” class to the image parent container.
September 22, 2022 at 6:50 am #2350560Josue
Hi Jesus,
What about the ones like me who only use the image block from Generateblocks? do you know by any chance what class we could add to the image parent container? -
AuthorPosts
- You must be logged in to reply to this topic.