Skip to content

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

Description

@crisc2000

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions