tronsha / wp-lightbox-plugin

WordPress Lightbox Plugin
https://wordpress.org/plugins/mpcx-lightbox/
MIT License
0 stars 2 forks source link

do not mess with the default behavior of scripts and wordpress #6

Open crisc2000 opened 6 years ago

crisc2000 commented 6 years ago

i used 1.15 and it used to work great. now i have updated to 1.22 and this don't work anymore. i have looked at your code and i have some observations.

1) do not mess with the default behavior of the box scripts i understand that you probably have created this for personal purposes, but the behaviour of the box scripts should be their default specified in their docs http://lokeshdhakar.com/projects/lightbox2/ , http://fancyapps.com/fancybox/3/docs/ . if a wordpress user add image code in the Wordpress text editor, according to the scripts documentation it should work exactly as the default. if you change the default behavior it you be as option in the plugin options, and that option it should not be the default.

you should not alter "data-lightbox / data-fancybox" or "data-title / data-caption" attribute if this attribute is already present on image link (even if is null). example, if this data is added in wordpress post text editor:

<a href="http://example.com/big_1.jpg" data-lightbox="group_1" data-title="title_1"><img src="http://example.com/small_1.jpg" /></a>
<a href="http://example.com/big_2.jpg" data-lightbox="" data-title=""><img src="http://example.com/small_2.jpg" /></a>
<a href="http://example.com/big_3.jpg" data-lightbox="group_1" data-title="title_3"><img src="http://example.com/small_3.jpg" /></a>

in new version of your plugin an existing data-lightbox attribute is modified breaking the grouping. old version work ok.

2) do not mess with the default behaviour of wordpress without giving options to user in the new version your plugin overwrite the default behavior of the gallery and standalone images without asking the user.

You should add some checkbox options: "Enable lightbox for wordpress gallery" "Enable lightbox for wordpress standalone images" I personally would prefer that this options to be disabled by default. the lightbox only to apply to images that have "data-lightbox/fancybox" attribute manually introduced by user.

tronsha commented 6 years ago

Thanks for the suggestions. I changed the code. Update the plugin in Wordpress to version 1.2.3.

I like the idea with the checkboxes. In a later version I will add that. As a standard value I will take "enabled", so that the behavior does not change suddenly when updating.