-
AuthorPosts
-
March 3, 2022 at 7:12 pm #1343044
Hi,
I have a similar question to the thread #1334473. I would like to have the lightbox always open with the thumbnail size “full”. It worked fine with this code but not anymore. `add_filter(“avf_alb_lightbox_image_size”, function($size) {
$size = “full”;
return $size;
}, 10, 2);`
Do I have to adjust this somehow?
Thank you.
Best regards,
VeraMarch 4, 2022 at 12:51 am #1343071Hey Vera,
Please try using this code:
add_filter("avf_alb_lightbox_image_size", function($size, $context) { $size = "full"; return $size; }, 10, 2);
Best regards,
NikkoMarch 4, 2022 at 10:48 am #1343096hm Nikko – and if she does not want to specify a context – ( for masonry or slideshow etc.) – her code seems to be ok.
But my test only influences image lightbox. Even if i try to change it for slideshow by:add_filter("avf_alb_lightbox_image_size", function($size, $context) { if($context = "avia_slideshow") { $size = "full"; } return $size; }, 10, 2);
And also even if i switch off the lightbox responsive option. No change
it has no effect.
the old snippet still works for it:
function change_lightbox_size() { return "full"; } add_filter('avf_avia_builder_helper_lightbox_size','change_lightbox_size', 10);
for masonry i still take:
function avia_change_masonry_thumbnail_lightbox_image($size){ return "full"; } add_filter('avf_avia_builder_masonry_lightbox_img_size', 'avia_change_masonry_thumbnail_lightbox_image', 10, 1);
March 4, 2022 at 11:06 am #1343098Hi,
thanks for your replies.
The so called “old snippet” proposed from Guenni007 works well. Thank you!
Best regards,
VeraMarch 4, 2022 at 2:30 pm #1343143Hi Vera,
Great, I’m glad that @guenni007 could help you out :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardMarch 4, 2022 at 2:40 pm #1343156But please Rikard – do check why that filter does not work in that manner.
my used filter is only mentioned as apply_filters_deprecated f.e. in class-avia-masonry.php andMarch 7, 2022 at 11:33 am #1343459Hi,
Syntax error:
if($context = "avia_slideshow") {
should be
if($context == "avia_slideshow") {
That is why it is recommended to write:
if( 'avia_slideshow' == $context ) {
which would throw a syntax error if you use ‘=’ by mistake.
Best regards,
GünterApril 1, 2022 at 2:56 pm #1346900That’s right – I hadn’t considered that. Thanks Günter.
But now to the context. I can find it by opening the corresponding alb and searching above for the if( ! class_exists( ‘xyz’ ) )but on slideshow i had to look into the avia-shortcode-helpers to find the correct context: avia_slideshow the slideshow.php itself got: avia_sc_slideshow
with gallery i had no clue to get the right context neither avia_gallery nor avia_sc_gallery works.
So how to determine the right context.
For gallery images i had to take nikos code without context to work as expected.- This reply was modified 2 years, 8 months ago by Guenni007.
April 2, 2022 at 12:17 pm #1346971Hi,
For the gallery if you look into gallery.php for the filter:
$lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', 'large', $this->config['shortcode'], $atts, $content );
it is
$this->config['shortcode'] = 'av_gallery'
This rule should follow in other shortcodes also.
Best regards,
GünterApril 3, 2022 at 8:26 pm #1347075thanks – so i had to look inside the function: function shortcode_insert_button() for shortcode!
But then it is for slideshow: av_slideshow ? Please test the snippet yourself – on my end this will not work under 4.9.2.1
This clarifies the question – but still not solved ? …April 4, 2022 at 11:24 am #1347112Hi,
Checking Enfold for the filter:
$lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', 'large', $this->config['shortcode'], $atts, $content );
is used in context of:
‘av_gallery’
‘av_horizontal_gallery’For masonry elements (class-avia-masonry.php):
$lightbox_img_size = apply_filters( 'avf_alb_lightbox_image_size', $lightbox_img_size, 'avia_masonry', $entry, $this->config );
For slideshow elements (class-avia-slideshow.php):
$this->config['lightbox_size'] = apply_filters( 'avf_alb_lightbox_image_size', $this->config['lightbox_size'], 'avia_slideshow', $this->config, '' );
It might need to extend the filter function and check the additional parameters of the filter if you need more control.
Best regards,
GünterApril 4, 2022 at 11:49 am #1347119yes with gallery it works this way – but on Ismaels link ( besides the == ) for slideshow it does not work.
April 6, 2022 at 10:49 am #1347391Hi there,
I have to come back to the problem in context with a gallery (only first image shown and other images via lightbox). Here I tried Guenni’s “old version” which had no effect:
function change_lightbox_size() { return "full"; } add_filter('avf_avia_builder_helper_lightbox_size','change_lightbox_size', 10);
Thank you for suggestions.
Best regards,
VeraApril 9, 2022 at 1:44 pm #1347778Hi Vera,
Sorry for the late reply.
Please check this:
On my install it works.
Best regards,
GünterApril 13, 2022 at 9:14 am #1348195Hi Günther,
thank you. It works!
Best regards,
VeraApril 13, 2022 at 11:46 am #1348210 -
AuthorPosts
- The topic ‘Full size image in lightbox’ is closed to new replies.