Пример #1
0
/**
 * Append gallery images to page automatically
 *
 * @since 1.0
 */
function easy_image_gallery_append_to_content($content)
{
    if (is_singular() && is_main_query() && easy_image_gallery_allowed_post_type()) {
        $new_content = easy_image_gallery();
        $content .= $new_content;
    }
    return $content;
}
Пример #2
0
/**
 * JS
 *
 * @since 1.0
 */
function easy_image_gallery_js()
{
    if (!easy_image_gallery_allowed_post_type() || !easy_image_gallery_is_gallery()) {
        return;
    }
    if (is_singular() && easy_image_gallery_has_linked_images()) {
        ?>

		<?php 
        $lightbox = easy_image_gallery_get_lightbox();
        switch ($lightbox) {
            case 'prettyphoto':
                ob_start();
                ?>
					
					<script>
					  jQuery(document).ready(function() {
					    jQuery("a[rel^='prettyPhoto']").prettyPhoto({
					    	social_tools : false,
					    	show_title : false
					    });
					  });
					</script>

					<?php 
                $js = ob_get_clean();
                echo apply_filters('easy_image_gallery_prettyphoto_js', $js);
                ?>

				<?php 
                break;
            case 'fancybox':
                ob_start();
                ?>

					<script>
						jQuery(document).ready(function() {

							jQuery("a.popup").attr('rel', 'fancybox').fancybox({
									'transitionIn'	:	'elastic',
									'transitionOut'	:	'elastic',
									'speedIn'		:	200, 
									'speedOut'		:	200, 
									'overlayShow'	:	false
								});
						});
					</script>

					<?php 
                $js = ob_get_clean();
                echo apply_filters('easy_image_gallery_fancybox_js', $js);
                ?>

				<?php 
                break;
            default:
                break;
        }
        // allow developers to add/modify JS
        do_action('easy_image_gallery_js', $lightbox);
        ?>

    <?php 
    }
    ?>

<?php 
}