Hi @kurapika
If you want to have all of the galleries switch from FooBox to FooGallery Lightbox, you can add the following code to your theme’s functions.php file to bulk change the lightbox:
add_filter('foogallery_settings_override', 'foogallery_custom_override_lightbox', 20, 3);
function foogallery_custom_override_lightbox( $settings, $gallery_template, $gallery ) {
$key = "{$gallery_template}_lightbox";
if ( array_key_exists( $key, $settings ) ) {
if ( $settings[$key] === 'foobox' ) {
$settings[$key] = 'foogallery';
}
}
return $settings;
}
Thanks.
Kind regards,
Elvis.
Thread Starter
Anonymous User 20597857
(@anonymized-20597857)
So ist das leider nicht gelöst, denn:
1. muss man dennoch die Einstellung jeder Galerie einmal aufrufen, andernfalls es nicht wirkt (da kann ich die Option gleich manuell ändern)
2. solange das Script in der functions.php ist, kann man keine neue Galerie anlegen (die Seite bleibt weiß, keine Fehlermeldung)
Hi @kurapika
Thanks for alerting me to the error. After analyzing the snippet, I identified the issue and modified it. Kindly use this now:
add_filter('foogallery_settings_override', 'foogallery_custom_override_lightbox', 20, 3);
function foogallery_custom_override_lightbox($settings, $gallery_template, $gallery) {
$key = "{$gallery_template}_lightbox";
if (is_array($settings) && array_key_exists($key, $settings)) {
if ($settings[$key] === 'foobox') {
$settings[$key] = 'foogallery';
}
}
return $settings;
}
I have tested this and it will work without causing the error. I’d also encourage you to use the WPCode plugin to add the code which will make it easier and safer for you. It will also automatically deactivate the script if it leads to any errors.
Thanks.
Kind regards,
Elvis.
Thread Starter
Anonymous User 20597857
(@anonymized-20597857)
Das Neu – Anlegen einer Galerie geht nun wieder.
Doch das Problem bleibt, dass man ohnehin alle Galerien anwählen muss. Das Script spart also nur den letzten Klick ein.
Ist dieser Options Wert irgendwo in der Datenbank gespeichert?
Wenn ja, könne man diesen ja per SQL nachträglich für alle ändern. Leider finde ich den nicht …
Ich notiere alle Script in der functions.php des Child Themes, ich verwende keine Code Plugins.