Viewing 3 replies - 1 through 3 (of 3 total)
  • Running two light box scripts at the same time is never a good idea. Even if theybare not conflicting or after disabling one of them for certain cases, it makes your site heavier than needed. So the best solution would be to try and use the funds light box for all other images on your site.

    But to answer your question: you could use a variation of the last code snippet given on https://www.ads-software.com/support/topic/only-load-fancy-box-js-code-css-on-one-page where you can use is_home() for the home page conditional.

    Hope that helps ??

    Thread Starter Bari007

    (@bari007)

    Hi.

    Thank you for the answer. I know that running two lightbox scripts is a bad idea, but I have no choice. The theme uses own lightbox script which I cannot disable, but it uses this script only for the homepage (portfolio boxes). But when I want to use image lightbox effect on the other pages, I have to use your plugin, because the theme does not provide lightbox for the other pages.

    Thread Starter Bari007

    (@bari007)

    But thank you for the hint! This solved my problem.

    add_action('wp_head','my_conditional_script',0);
    
    function my_conditional_script() {
        if (is_home() || is_front_page()) {
            remove_action('wp_enqueue_scripts', array('easyFancyBox', 'enqueue_styles'), 999);
            remove_action('wp_head', array('easyFancyBox', 'main_script'), 999);
            remove_action('wp_print_scripts', array('easyFancyBox', 'register_scripts'), 999);
            remove_action('wp_footer', array('easyFancyBox', 'enqueue_footer_scripts'));
            remove_action('wp_footer', array('easyFancyBox', 'on_ready'), 999);
        }
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable FancyBox for homepage’ is closed to new replies.