• hello,
    I am trying to optimize webpage. I use separate lightbox for video (ari fancybox) and Meow Lightbox for the gallery.

    I am optimizing by disabling unnecessary plugins in must-use plugin. I am disabling ari fancybox on gallery page (see code below). This action also cripples meow lightbox plugin in a way that REST path is not created and ajax call to enumerate images does not succeed. Therefore, lightbox does not work. Do you know why? Many thanks.

    <?php
    // returns the path of the request URI without the query string
    // see http://php.net/manual/en/function.parse-url.php
    // and http://php.net/manual/en/reserved.variables.server.php
    // and http://php.net/manual/en/url.constants.php
    
    $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
     
    $is_admin = strpos( $request_uri, '/wp-admin/' );
    
    // add filter in front pages only
    if( false === $is_admin ){
    	add_filter( 'option_active_plugins', 'do_option_active_plugins' );
    }
    
    /**
     * Filters active plugins
     *
     * @param array   $plugins An array of active plugins.
     */
    function do_option_active_plugins( $plugins ){
    
    	global $request_uri;
    
    	$plugins1 = $plugins;
    
    	switch ($request_uri) {
    		case '/':
    			$unnecessary_plugins = array(
    				'meow-gallery/meow-gallery.php',
    				'meow-lightbox/meow-lightbox.php',
    				'ari-fancy-lightbox/ari-fancy-lightbox.php',
    				);
    			break;
    		case '/video-galerija/':
    				$unnecessary_plugins = array(
    				'meow-gallery/meow-gallery.php',
    				'meow-lightbox/meow-lightbox.php',
    				);
    			break;
    		case '/galerija/':
    			$unnecessary_plugins = array(
    				'ari-fancy-lightbox/ari-fancy-lightbox.php'
    				);
    			break;
    		
    		default:
    			$unnecessary_plugins = array(
    				'meow-gallery/meow-gallery.php',
    				'meow-lightbox/meow-lightbox.php',
    				'ari-fancy-lightbox/ari-fancy-lightbox.php'
    				);
    			break;
    	}
    
    	$plugins1 = array_diff($plugins, $unnecessary_plugins);
    
    	//$plugins1 = array_replace($plugins, array_fill_keys(array_keys(array_intersect($plugins, $unnecessary_plugins)), ""));
    	// var_dump($plugins);
    	// var_dump($plugins1);
    
    	return $plugins1;
    }
    • This topic was modified 5 years, 3 months ago by Lovro Hrust.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Lovro Hrust

    (@lovor)

    — deleted comment —

    • This reply was modified 5 years, 3 months ago by Lovro Hrust.
    Plugin Author Jordy Meow

    (@tigroumeow)

    Indeed, that would break the current version of the Meow Lightbox. But if you can wait a few days, a new version of the plugin will be released, not using the WP-API anymore. We wanted to optimize the plugin more and to avoid issues related to the API. So basically that will fix your issue. Probably the new version will be released next week 🙂 This also depends on my colleague Thomas (he is the one finalizing the update right now), and if you want to give us a bit of motivation, do not hesitate to leave a good review for this plugin; and don’t hesitate to mention that you are really looking forward to the new version that doesn’t need the API 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘ajax problem’ is closed to new replies.