Support » Plugin: Easy FancyBox » Disable plugin certain images

  • Resolved phineas137


    Is there any php code to desactivate the plugin in certain images? I insert the images with the ACF plugin and I want to disable Easy Fancy Box for non registered users.

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


    Hi, so do you wish to disable the light box for certain images or for certain visitors?

    In the first case (images) you can give the image link in question a class=”nolightbox” attribute. This will prevent FancyBox from binding itself to the media link.

    In the second case (users) you might be able to write some PHP that adds this class only for anonymous visitors using if ( !is_user_logged_in() ) { ... } for example. See

    Thread Starter phineas137


    Thanks for your reply RavanH. I used the attribute, the FancyBox don’t work but when I click on the image it’s open the image on path. This is the code I’m using;

    $image = get_field('logo_game');
    if( !empty($image) ):
    	// vars
    	$url = $image['url'];
    	$title = $image['title'];
    	$alt = $image['alt'];
    	$caption = $image['caption'];
    	// thumbnail
    	$size = 'large';
    	$thumb = $image['sizes'][ $size ];
    	$width = $image['sizes'][ $size . '-width' ];
    	$height = $image['sizes'][ $size . '-height' ];
    	if( $caption ): ?>
    		<div class="wp-caption">
    	<?php endif; ?>
    	<a class="nolightbox" href="<?php echo $url; ?>" title="<?php echo $title; ?>">
    		<img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
    	<?php if( $caption ): ?>
    			<p class="wp-caption-text"><?php echo $caption; ?></p>
    	<?php endif; ?>
    <?php endif; ?>
    • This reply was modified 2 years, 11 months ago by phineas137.
    Plugin Author RavanH


    So I gather you want FancyBox to work for logged in users and not for anonymous visitors?

    Then you could try replacing the line

    <a class="nolightbox" href="<?php echo $url; ?>" title="<?php echo $title; ?>">


    <a <?php if ( !is_user_logged_in() ) echo 'class="nolightbox"'; ?> href="<?php echo $url; ?>" title="<?php echo $title; ?>">
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable plugin certain images’ is closed to new replies.