????

Your IP : 216.73.216.152


Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls/partials/blog/media/
Upload File :
Current File : /home2/morganrand/www/wp-content/themes/wanderfuls/partials/blog/media/blog-single-gallery.php

<?php
/**
 * Blog single post gallery format media
 *
 * @package Wanderfuls WordPress theme
 * @subpackage Partials
 * @version 3.0.0
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// Get attachments
$attachments = tb_get_gallery_ids( get_the_ID() );

// Return standard entry style if password protected or there aren't any attachments
if ( post_password_required() || empty( $attachments ) ) {
    get_template_part( 'partials/blog/media/blog-entry' );
    return;
}

// Check if lightbox is enabled
if ( tb_gallery_is_lightbox_enabled() || tb_get_mod( 'blog_post_image_lightbox' ) ) {
    $lightbox_enabled = true;
    tb_enqueue_ilightbox_skin(); // Load lightbox skin stylesheet
} else {
    $lightbox_enabled = false;
} ?>

<div id="post-media" class="clr">

    <div class="gallery-format-post-slider">

        <div class="tb-slider-preloaderimg">
            <?php
            // Display first image as a placeholder while the others load
            tb_blog_entry_thumbnail( array(
                'attachment'    => $attachments[0],
                'alt'           => get_post_meta( $attachments[0], '_wp_attachment_image_alt', true ),
            ) ); ?>
        </div><!-- .tb-slider-preloaderimg -->

        <div class="tb-slider slider-pro" <?php tb_blog_slider_data_atrributes(); ?>>

            <div class="tb-slider-slides sp-slides <?php if ( $lightbox_enabled ) echo 'lightbox-group'; ?>">

                <?php
                // Loop through attachments
                foreach ( $attachments as $attachment ) : ?>

                    <?php
                    // Get attachment data
                    $lightbox_url       = $lightbox_enabled ? tb_get_lightbox_image( $attachment ) : '';
                    $attachment_data    = tb_get_attachment_data( $attachment );
                    $attachment_alt     = $attachment_data['alt'];
                    $attachment_video   = $attachment_data['video'];
                    $attachment_caption = $attachment_data['caption'];

                    // Get image output
                    $attachment_html    = tb_get_blog_entry_thumbnail( array(
                        'attachment'    => $attachment,
                        'alt'           => $attachment_alt,
                    ) ); ?>

                    <div class="tb-slider-slide sp-slide">

                        <?php
                        // Display attachment video
                        if ( $attachment_video && ! is_wp_error( $attachment_video = wp_oembed_get( $attachment_video ) ) ) : ?>

                            <div class="tb-slider-video responsive-video-wrap">
                                <?php echo $attachment_video; ?>
                            </div><!-- .tb-slider-video -->

                        <?php
                        // Display attachment image
                        else : ?>

                            <div class="tb-slider-media clr">

                                <?php
                                // Display with lightbox
                                if ( $lightbox_enabled ) : ?>

                                    <a href="<?php echo $lightbox_url; ?>" title="<?php echo $attachment_alt; ?>" data-title="<?php echo $attachment_alt; ?>" data-type="image" class="tb-lightbox-group-item"><?php echo $attachment_html; ?></a>

                                <?php
                                // Display single image
                                else : ?>

                                    <?php echo $attachment_html; ?>

                                    <?php if ( $attachment_caption ) : ?>
                                        <div class="tb-slider-caption sp-layer sp-black sp-padding clr" data-position="bottomCenter" data-show-transition="up" data-hide-transition="down" data-width="100%" data-show-delay="500">
                                            <?php echo $attachment_caption; ?>
                                        </div><!-- .tb-slider-caption -->
                                    <?php endif; ?>

                                <?php endif; ?>

                            </div><!-- .tb-slider-media -->

                        <?php endif; ?>

                    </div><!-- .tb-slider-slide sp-slide -->

                <?php endforeach; ?>

            </div><!-- .tb-slider-slides .sp-slides -->

            <div class="tb-slider-thumbnails sp-thumbnails">

                <?php
                // Loop through attachments
                foreach ( $attachments as $attachment ) : ?>

                    <?php
                    // Display image thumbnail
                    tb_blog_entry_thumbnail( array(
                        'attachment'    => $attachment,
                        'class'         => 'tb-slider-thumbnail sp-thumbnail',
                        'alt'           => get_post_meta( $attachments, '_wp_attachment_image_alt', true ),
                    ) ); ?>

                <?php endforeach; ?>

            </div><!-- .tb-slider-thumbnails -->

        </div><!-- .tb-slider .slider-pro -->

    </div><!-- .gallery-format-post-slider -->

</div><!-- .blog-entry-media -->