• Resolved xdirex

    (@xdirex)


    Hi,

    Great plugin and makes integration really easy.

    The issue from my end is that I only need to use this feature on a single page, and possibly a couple more in the future if the client sees a need.

    I have a large site and excluding page IDs one by one would be an enormous task.

    1) Is there a solution to exclude ALL pages, except what is activated on the ‘edit’ screen or added to an ‘include’ list.

    2) Perhaps in a future update, the settings could include a radio button that allows the user to select between ‘exclude pages’ mode or ‘include pages’ mode.

    I’d greatly appreciate your help on this issue. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    You can write a custom filter in your themes functions.php and manage the “enabled” flag yourself. Also see the FAQ, section “How to disable the plugin in certain pages/posts” which shows how to disable the lightbox an all WooCommerce product pages.

    To have the lightbox only enabled on a specific ID, you could use the following filter:

    
    function my_lbwps_enabled($enabled, $id)
    {
        // This is the list of page/post IDs on which the lightbox
        // should be enabled (for example 5, 17 and 132)
    
        $allowed_ids = [ 5, 17, 132 ];
    
        $enabled = in_array($id, $allowed_ids);
        return $enabled;
    }
    
    add_filter('lbwps_enabled', 'my_lbwps_enabled', 10, 2);
    
    Thread Starter xdirex

    (@xdirex)

    Excellent, this has worked perfectly.
    – The PhotoSwipe functionality is now disabled for all pages.
    – It’s enabled for page IDs I’ve added to the $allowed_ids array.

    Thanks for your help. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable for all pages but selected’ is closed to new replies.