• Resolved ElectricFeet

    (@electricfeet)


    Thanks again for the plugin (I’ve just written the first review).

    One thing would be a reeeeeallly nice addition: the ability to switch it off on certain pages/posts etc. I’m thinking particularly of things like WooCommerce, which already loads photoswipe and where it could cause compatibility problems (though I haven’t spotted any so far). There will undoubtedly be other situations where loading the images into photoswipe doesn’t make sense and where the ability to selectively disable it would be nice.

    Would it be possible to apply a filter somewhere, so that we can add a filter in child themes? This would allow us, for example, to switch it off in WooCommerce product pages with is_product(). (Unfortunately, WooCommerce is_product() is loaded quite late, so it cannot be added to the if(!is_admin()) condition in the plugin’s construct function.)

    • This topic was modified 7 years, 3 months ago by ElectricFeet.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    Thanks for the suggestions – I’ll see what I can do. I want to add same backend configuration anyway, so this could be one of the things to be added there.

    Plugin Author Arno Welzel

    (@awelzel)

    Sorry for the very long delay – but I finally added a setting in the backend to exclude the lightbox from certain pages/post. On those pages/posts the images will not be touched and also all scripts and styles will not be included at all.

    Concerning the filter – if you still need this: for what specific event would you like to have the filter? At the same positions, where the plugin checks, if a post/page was disabled by the backend setting? Just let me know, and I’ll add this as well.

    Thread Starter ElectricFeet

    (@electricfeet)

    Wow, thanks for picking up on this one. I’ve been away from things for a while too, so it’s not been a problem from this end.

    The original filter idea was to save you the work of implementing it in the back end GUI. If you’ve done that work, then maybe there would be no need for the filter.

    Trying to think through what I haven’t yet implemented — a WooCommerce shop — what might be a problem for sites with fast-changing products would be having to exclude each product every time they are added. In that case, some sort of filter based on WooCommerce’s is_product() might still be needed. So a filter that stops processing of your code if a certain condition is met could perhaps still be useful.

    For me personally, it’s not an issue, as the shop I will implement has few products. For others it might, but I’ve not been following your user base to know if it is or not.

    Thanks for following up!

    Plugin Author Arno Welzel

    (@awelzel)

    I just pushed an update (1.60) which also provides a filter to disable the lightbox (besides other new features like new skins).

    Example:

    
    // Disable Lightbox with PhotoSwipe on WooCommerce product pages
    
    function my_lbwps_enabled($id, $enabled)
    {
        if( function_exists( 'is_product' ) )
        {
            if( is_product() ) return false;
        }
    
        return $enabled;
    }
    
    add_filter( 'lbwps_enabled', 'my_lbwps_enabled', 10, 2 );
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Enhancement request’ is closed to new replies.