WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Limit Easy Fancybox to certain images (4 posts)

  1. trishahdee
    Member
    Posted 1 year ago #

    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/

  2. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. trishahdee
    Member
    Posted 1 year ago #

    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);
        }
    }
  4. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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 ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic