PhotoSwipe icon indicating copy to clipboard operation
PhotoSwipe copied to clipboard

Add an option to change the prefix for CSS class names

Open arnowelzel opened this issue 2 years ago • 3 comments

Also see: https://wordpress.org/support/topic/control-buttons-displayed-2x-and-shifted/#post-16124030

As you know, I provide a free plugin for WordPress which integrates PhotoSwipe 5 for every image link (https://wordpress.org/plugins/lightbox-photoswipe/).

Some people use WordPress with WooCommerce. WooCommerce also integrates PhotoSwipe, but the older version 4. The lightbox feature of WooCommerce can be disabled, but it seems even then WooCommerce adds the CSS for PhotoSwipe 4 to the site.

This will conflict with the CSS for PhotoSwipe 5, so one ends up with elements which contain a mixture of old and new elements like this:

image

Of course the real fix should be to remove the old PhotoSwipe 4 styles from the site - however this is not that easy for the end user as he would need to change the core code of WooCommerce to avoid enqueuing the styles.

As this may happen for other instances as well, it would be helpful to be able to optionally change the prefix for the CSS classes, e.g. from .pswp__ to .pswp5__ so one could provide a custom stylesheet which will not conflict with existing styles for PhotoSwipe 4.

arnowelzel avatar Oct 22 '22 08:10 arnowelzel

Also reported here: https://wordpress.org/support/topic/double-lightbox-15/

anastas10s-afk avatar Nov 08 '22 15:11 anastas10s-afk

I am encountering the same issue.

@arnowelzel My current workaround is adding an additional class to the Photoswipe wrapper via https://photoswipe.com/options/#mainclass and to edit my Photoswipe CSS accordingly.

Would still be great to have a built-in option to customise the Photoswipe class prefix.

@anastas10s-afk Sorry if that is not the right place, but as the issue for me also relates to the Woo single product gallery lightbox: Are there any plans to update Woo core to use Photoswipe 5? As the 4.1.1 that WooCommerce currently uses in from the end of 2015.

ehrig avatar May 03 '23 14:05 ehrig

Thanks for the hint about https://photoswipe.com/options/#mainclass - I didn't realize, that such a thing exists. Maybe this is already sufficient to fix my issue, I'll check this.

arnowelzel avatar May 04 '23 12:05 arnowelzel