Viewing 7 replies - 1 through 7 (of 7 total)
  • Check examples how to use is page function to specify your page(s).
    Modify and add this to functions.php file of your theme

    function disable_fancybox() {
    	if (is_page('Sample Page')) {
    		remove_action('wp_print_scripts', 'mfbfw_load');
    	        remove_action('wp_print_styles', 'mfbfw_css');
                    remove_action('wp_head', 'mfbfw_init');
            }
    }
    add_action('wp_head', 'disable_fancybox', 1);

    It will disable “FancyBox for WordPress” plugin scripts and style on specified pages.

    Thread Starter vladimir_dolezel

    (@vladimir_dolezel)

    Wow…work great! Thank you very much!

    Hi there.

    First of all great plugin! I’ve tried using the code above for multiple pages. This is the code I used:
    function disable_fancybox() {
    if (is_page array(‘photos’,’artwork’)) {
    remove_action(‘wp_print_scripts’, ‘mfbfw_load’);
    remove_action(‘wp_print_styles’, ‘mfbfw_css’);
    remove_action(‘wp_head’, ‘mfbfw_init’);
    }
    }
    add_action(‘wp_head’, ‘disable_fancybox’, 1);

    and this is the error code I get:
    Parse error: syntax error, unexpected T_ARRAY in /home2/bassfoun/public_html/wp-content/themes/bassfoundation/functions.php on line 515

    line 515 is: if (is_page array(‘photos’,’artwork’)) {

    Really stuck with this and hope you can help ??

    Many thanks,

    Maarten

    if ( is_page(array('photos','artwork')) ) {
    find the difference ??

    Thanks vjpo (: great work

    Thanks for this but I have added fancybox using the plugin, so how do I disable it considering I don’t have print_script and style names to remove?

    I actually discovered a link-by-link solution this morning that I wanted to pass along.

    If you add the class “nolightbox” to your link that is usually meant to open in Fancybox, it will open as a regular link.

    As in:
    <a class="thumb-link nolightbox" href="my-image.jpg"><img width="100" height="100" src="my-image-thumb.jpg" alt="This is alt text" title="This is the title"></div></a>

    Seems to be baked in already. I wish the plugin author had made it a little more readily available…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Disable fancybox in specific page’ is closed to new replies.