Support » Plugins and Hacks » Easy FancyBox » Limit Easy Fancybox to certain images

  • Resolved Trishah

    (@trishahdee)


    I’m using a shopping cart that already has it’s own shadowbox effect for images. I want to limit Easy Fancybox to only certain images on the site outside the cart.

    I have tried unchecking “Images & Inline content” then adding the class="fancybox" to certain images but that is not working. I’ve checked in both FireFox v17 and Chrome v20.

    Any ideas how to accomplish this?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author RavanH

    (@ravanh)


    You’ll have to clear the field where the autodetectable file types are defined (.jpg .png etc.) and then autodetection for images will be off. Then, only links that have your set class=’fancybox’ will work.

    Trishah

    (@trishahdee)


    Oh… I see now… What I did was uncheck “Enable FancyBox for Images & Inline content” and use the class on the images. But what I should have done was keep that checked and remove the image extensions from the “Images & Inline content: Auto-detect” input field.

    What I did instead was to use functions.php to keep Easy Fancybox from being active in the shopping cart folders that already have a shadowbox on images. This way I don’t have to add the class to every image. Here is that solution if anyone is interested:

    add_action('wp_head','stop_easy_fancybox',0);
    
    function stop_easy_fancybox() {
    if(preg_match("/\/folder_name_1\//",$_SERVER['REQUEST_URI']) ||
    preg_match("/\/folder_name_2\//",$_SERVER['REQUEST_URI'])){
    
            remove_action('init','easy_fancybox_init');
            remove_action('wp_print_styles', 'easy_fancybox_enqueue_styles', 999);
            remove_action('wp_enqueue_scripts', 'easy_fancybox_enqueue_scripts', 999);
            remove_action('wp_head', 'easy_fancybox', 999);
        }
    }
    Plugin Author RavanH

    (@ravanh)


    Thanks for sharing Trishah.

    You can also use a class to prevent fancybox from being attached: class="nofancybox" … handy for those cases where you only occasionally want to disable FancyBox 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limit Easy Fancybox to certain images’ is closed to new replies.