• Awesome plugin! Unfortunately, it breaks HTML5 validation on my site which used to have 100% no errors (I worked so hard to get no errors).

    Issue:
    Original, before plugin: <img src=”https://picture.jpg&#8221; />
    After plugin: <img src=”https://picture.jpg&#8221; / data-imagelightbox=”f”>
    Problem: Forward slash appears before ‘data-imagelightbox’ instead of closing /> at the end.
    Expected result: <img src=”https://picture.jpg&#8221; data-imagelightbox=”f” />

    The plugin still works, but because of the forward slash appearing in the wrong place (the /> is getting split up), it doesn’t pass HTML5.

    I’m guessing it has something to do with this preg_replace code in wp-imagelightbox.php file:
    $pattern = “/<a(.*?)href=(‘|\”)(.*?).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)>/i”;

    Unfortunately, I don’t know how to code well enough to fix it by myself. I found this other fantastic WordPress implementation of ImageLightbox.js in WordPress Plugins repository: https://www.ads-software.com/plugins/&#8230;
    It works great too and passes 100% HTML5 validation.

    I would rather use your plugin as it has better interface appearance/CSS.

    Please advise on how to fix. Thank you in advance. ??

    https://www.ads-software.com/plugins/wp-imagelightbox/

Viewing 1 replies (of 1 total)
  • Thread Starter fruityoaty

    (@fruityoaty)

    It’s OK… finally figured out how to make it HTML5 validate on my site. Now, no errors.

    $pattern = “/<a(.*?)href=(‘|\”)(.*?).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)(|\/)>/i”;
    $replacement = ‘<a$1href=$2$3.$4$5$6 data-imagelightbox=”‘.$type.'”$7>’;

Viewing 1 replies (of 1 total)
  • The topic ‘HTML5 Validation (forward slash issue)’ is closed to new replies.