Skip to content

Instantly share code, notes, and snippets.

@jubalm
Created April 30, 2012 02:52
Show Gist options
  • Save jubalm/2555117 to your computer and use it in GitHub Desktop.
Save jubalm/2555117 to your computer and use it in GitHub Desktop.
wordpress - fancybox
jQuery(function ($) {
$('.gallery .gallery-item a').attr('rel', 'fancybox').fancybox();
})
<?php
// Load Fancybox Dependencies with [gallery] shortcode
add_action('post_gallery', 'load_fancybox_dep');
function load_fancybox_dep()
{
wp_enqueue_style( 'fancybox', get_bloginfo('template_directory') .'/css/jquery.fancybox-1.3.4.css' );
wp_enqueue_script( 'fancybox', get_bloginfo('template_directory') .'/js/jquery.fancybox-1.3.4.pack.js', 'jquery', '1.3.4', true );
wp_enqueue_script( 'config-fancybox', get_bloginfo('template_directory' ) .'/js/config.fancybox.js', 'fancybox', '1.0', true );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment