WordPress.org

Ready to get started?Download WordPress

Forums

FancyBox for WordPress
Disable fancybox in specific page (8 posts)

  1. vladimir_dolezel
    Member
    Posted 2 years ago #

    Hello,
    it is possible disable fancybox in specific wordpress page? Thank you for answer.

    Vladimir

  2. vjpo
    Member
    Posted 2 years ago #

    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.

  3. vladimir_dolezel
    Member
    Posted 2 years ago #

    Wow...work great! Thank you very much!

  4. bassfoundation
    Member
    Posted 2 years ago #

    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

  5. vjpo
    Member
    Posted 2 years ago #

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

  6. Ramzii
    Member
    Posted 2 years ago #

    Thanks vjpo (: great work

  7. nicolaelvin
    Member
    Posted 1 year ago #

    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?

  8. B1gJ4k3
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic