• Are you really binding your functionality through PHP content filtering?

    Are you out of your mind ? ??

    This is something that should be, on 100%, done on the frontend with JS…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Archetyped

    (@archetyped)

    Howdy, SLB’s lightbox functionality is indeed fully JS-powered. However, PHP is used where necessary to provide things like admin settings, modular media support (images, videos, etc.), robust themes, and extensible functionality.

    There are numerous JS-only lightboxes out there if that’s what you want, just don’t expect any of them to work with media attachment links ?? SLB is built from the ground-up to be deeply integrated with WordPress, which includes using PHP where appropriate.

    Have a great day!

    • This reply was modified 7 years, 10 months ago by Archetyped.
    Thread Starter jave.web

    (@javeweb)

    I don’t mind if you use PHP, where necessary (settings, some theming, shortcodes, etc…), I just really don’t understand why are you using it for binding the JS functionality to images – can you provide example why wouldnt’t it work? (I have completely different experience, but there can be always something uknown…)

    I will be glad to help you improve this if possible, but first I need to know why you think JS-only solution would not “work with media attachment links”.

    Plugin Author Archetyped

    (@archetyped)

    Hmm, it sounds like you haven’t actually used SLB as several notes you made are not accurate.

    I would be glad to help, but I would recommend installing and using the plugin first so that I don’t have to start from square one. Many things should be much clearer for you after that.

    For starters, here is WordPress’ documentation on inserting an image linked to a media attachment page. This should help you quickly create a media attachment link and test other lightbox plugins to see if they work with that link.

    Have a great day!

    Thread Starter jave.web

    (@javeweb)

    On the contrary…

    I’ve ran up into it on one of client’s site. Where, when I wanted to apply your plugin’s JS functionality, I had to actually use a PHP function to filter the custom content – slb_activate() .

    Anyway, you did not provide ANY valid reason why

    1. Your JS does not bind on any CSS class one could then easily and more efficiently use to bind your JS functionality.
    2. Why it wouldn’t work…

    Let me show you a few examples on how to do it purely in JS (jQuery):
    1. General $('a > img').parent() will get you all image links, may be too hungry, you might want to provide option to set “content” class.

    2. Every attachment image inserted into content (when not messed with in other way) has a class “wp-image-#” so $('a > img').filter('[class*="wp-image-"]').parent() is more specific, same goes for wp-post-image and featured-image … Even images generated with wp_get_attachment_image() have attachment-SIZECLASS.

    3. Add an option to provide a custom selector.

    • This reply was modified 7 years, 10 months ago by jave.web.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Mindless behaviour’ is closed to new replies.