Title: Mindless behaviour
Last modified: January 26, 2017

---

# Mindless behaviour

 *  [jave.web](https://wordpress.org/support/users/javeweb/)
 * (@javeweb)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/)
 * 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](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/#post-8699851)
 * 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 9 years, 4 months ago by [Archetyped](https://wordpress.org/support/users/archetyped/).
 *  Thread Starter [jave.web](https://wordpress.org/support/users/javeweb/)
 * (@javeweb)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/#post-8705972)
 * 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](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/#post-8707983)
 * 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](https://codex.wordpress.org/Inserting_Images_into_Posts_and_Pages#Image_Link).
   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](https://wordpress.org/support/users/javeweb/)
 * (@javeweb)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/#post-8715475)
 * 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 9 years, 4 months ago by [jave.web](https://wordpress.org/support/users/javeweb/).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Mindless behaviour’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-lightbox.svg)
 * [Simple Lightbox](https://wordpress.org/plugins/simple-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-lightbox/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [jave.web](https://wordpress.org/support/users/javeweb/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/mindless-behaviour/#post-8715475)
 * Status: not a support question