• Resolved Brandon Dove

    (@brandondove)


    Nice plugin. I’m having a compatibility problem with this plugin and Gravity Forms though. This plugin uses is_plugin_page() to detect when to load it’s javascripts in the admin. This is a problem because it loads it on every plugin page. Instead, why not check for the plugin’s page hook and only load it on the fancybox pages. I’m adding code to this post that will fix it. I hope you can get to incorporating it into your plugin. Please let me know if you have any questions.

    LINE 352-353

    $mfbfw_admin_page = add_submenu_page('options-general.php', 'Fancybox for WordPress Options', 'Fancybox for WP', 10, 'fancybox-for-wordpress', 'mfbfw_options_page');
    add_action('admin_print_scripts-'.$mfbfw_admin_page, 'mfbfw_load_admin');     // Load FancyBox Script

    CREATE THIS FUNCTION
    1// Here we load FancyBox JS with jQuery and jQuery.easing if necessary
    function mfbfw_load_admin() {

    wp_enqueue_script(‘jquery-ui-tabs’, array(‘jquery-ui-core’)); // Load jQuery UI Tabs for Admin Page

    wp_enqueue_script(‘fancyboxadmin’, FBFW_URL . ‘/js/admin.js’, array(‘jquery’), ‘1.3.2’); // Load specific JS for Admin Page

    }`

    CHANGE THIS FUNCTION

    // Here we load FancyBox JS with jQuery and jQuery.easing if necessary
    function mfbfw_load() {
    
    	$settings = mfbfw_get_settings();
    
    	if ($settings['loadAtFooter']) $loadAtFooter = true;
    
    	if (!is_admin()) { // avoid the scripts from loading on admin panel
    
    		if ($settings['nojQuery']) {
    
    			wp_enqueue_script('fancybox', FBFW_URL . '/js/jquery.fancybox-1.2.6.min.js', $loadAtFooter); // Load fancybox without jQuery (for troubleshooting)
    
    		} else {
    
    			wp_enqueue_script('fancybox', FBFW_URL . '/js/jquery.fancybox-1.2.6.min.js', array('jquery'), '1.3.2', $loadAtFooter); // Load fancybox with jQuery
    
    		}
    
    		if (get_option('mfbfw_easing')) {
    
    			wp_enqueue_script('jqueryeasing', FBFW_URL . '/js/jquery.easing.1.3.min.js', array('jquery'), '1.3.2', $loadAtFooter); // Load easing javascript file if required
    
    		}
    
    	}
    
    }

    https://www.ads-software.com/extend/plugins/fancybox-for-wordpress/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: FancyBox for WordPress] There's a problem with "is_plugin_page()"’ is closed to new replies.