WordPress.org

Ready to get started?Download WordPress

Forums

FancyBox for WordPress
[resolved] There's a problem with "is_plugin_page()" (4 posts)

  1. Brandon Dove
    Member
    Posted 3 years ago #

    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
    
    		}
    
    	}
    
    }

    http://wordpress.org/extend/plugins/fancybox-for-wordpress/

  2. José Pardilla
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    Thanks for taking the time to point that out.

    Since the next big version is going to require more testing than i would like, i'm going to put together a little update to 2.7.3 with this and a few other little fixes.

  3. José Pardilla
    Member
    Plugin Author

    Posted 3 years ago #

    The update is out, this should be resolved now.

  4. Brandon Dove
    Member
    Posted 3 years ago #

    I installed the update and the issue is resolved. Thanks for jumping on this.

    -Brandon

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic