Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    As i said by mail:

    Your theme already includes fancybox, it’s loading the file: http://doodlegoose.com/wp-content/themes/fotofolio-landscape/js/fancybox/jquery.fancybox-1.3.0.pack.js

    If you want to use the plugin you can disable that call but you will have to check that the theme doesn’t break when removing the duplicate fancybox.

    Or you can disable the plugin and use the fancybox installation from your theme, and customize it if necessary editing the theme files. In the theme, fancybox might be loaded from the file functions.php.

    ———

    Now relying your last email, fancybox itself doesn’t detect all images in your blog unless your theme’s implementation of fancybox tells it to do so.

    You can do something like that with this JS code:

    var thumbnails = 'a:has(img)[href$=".jpg"]';
    jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox");

    This a short version of what fancybox for wordpress uses to auto-detect image links.

    This way you would add the fancybox class to all links that contain a thumbnail and link to a bigger picture. Then you execute fancybox on the fancybox class:

    jQuery("a.fancybox").fancybox();

    Then just manually configure any settings you want following this documentation. http://fancybox.net/api

    Thread Starter nayefc

    (@nayefc)

    Oh – got it, thanks..

    One last question, I am a programmer but never used WordPress before. So where do I add all this code in? In which class?

    Thanks,

    You have to search where you wordpress theme is inserting its javascript from, check first if the theme has an options page in the wordpress admin panel, it might have a field to edit the JS there. If it’s not the case which is probable, you will have to look in functions.php in the theme folder.

    Here’s some example code, with the fancybox call from your theme and another one for you to edit. Or you can just leave one call if you prefer though.

    var $j = jQuery.noConflict();
    
    $j(document).ready(function() {
    
    	var thumbnails = 'a:has(img)[href$=".jpg"],a:has(img)[href$=".JPG"]'; // variable with extensions we want to support
    	$j(thumbnails).addClass("fancybox").attr("rel","fancybox"); // add class="fancybox" to all links that match the extension criteria
    
    	// custom fancybox call
    	$j("a.fancybox").fancybox({
    		'autoScale': false,
    		'titleShow': true,
    		'titlePosition': 'inside',
    		'centerOnScroll': true,
    		'hideOnContentClick': false
    	});
    
    	// Original fancybox call from theme
    	$j("a.full").fancybox({
    		'autoScale': false,
    		'titleShow': true,
    		'titlePosition': 'inside',
    		'centerOnScroll': true,
    		'hideOnContentClick': false
    	});
    
    });
    
    $j(document).bind("contextmenu",function(e){
    	return false;
    });
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: FancyBox for WordPress] Gallery not showing up’ is closed to new replies.