Custom WordPress theme – fancybox not working?

Solution:

You can start with this checklist (may not be everthing) :

1). Your page doesn’t have a proper DOCTYPE (don’t ask me why), you can fix that in your new theme template.

2). You don’t seem to be using lightbox so remove this reference

wp_enqueue_script( 'lightbox', get_template_directory_uri() . '/inc/lightbox/js/jquery.lightbox.js', array('fancybox'), false, true );

3). You are loading fancybox css stylesheet as script, hence the error

Timestamp: 31/03/2013 1:14:48 PM
Error: SyntaxError: syntax error
Source File: http://jarsis.de/tground/wp-content/themes/cys/inc/lightbox/css/jquery.fancybox.css?ver=3.5.1
Line: 2
Source Code: .fancybox-wrap, 

… so you would need to replace this line :

wp_enqueue_script( 'lightbox-style', get_template_directory_uri() . '/inc/lightbox/css/jquery.fancybox.css' );

by this :

wp_enqueue_style( 'lightbox-style', get_template_directory_uri() . '/inc/lightbox/css/jquery.fancybox.css' );

… but it depends on how you registered the new stylesheet.

4). You may need to wrap your fancybox initialization code inside the .ready() method like :

(function($) { 
  $(function(){
     $(".fancybox").fancybox();
  });
})(jQuery);