예제 #1
0
function zn_get_post_image($post_id = null, $width, $height = 0, $attr = array(), $popup = false)
{
    $post_id = null === $post_id ? get_the_ID() : $post_id;
    $attachment_id = get_post_thumbnail_id($post_id);
    return zn_get_image($attachment_id, $width, $height, $attr, $popup);
}
예제 #2
0
    function element()
    {
        $images = $this->opt('images') ? $this->opt('images') : false;
        $count = $this->opt('count', 3);
        $custom_img_size = $this->opt('custom_img_size') === 'yes' ? true : false;
        $autoScroll = $this->opt('auto_scroll') === 'yes' ? 'true' : 'false';
        $use_popup = $this->opt('use_popup') !== 'yes' ? false : true;
        $timeout_duration = $this->opt('timeout_duration') ? $this->opt('timeout_duration') : '2500';
        //** Appear animation
        $appear_delay = $this->opt('appear_delay') ? $this->opt('appear_delay') : '0';
        $appear = $this->opt('appear_animation') ? $this->opt('appear_animation') : '';
        if (!empty($appear)) {
            $appear = 'data-appear="fade-in" data-appear-direction="' . $appear . '" data-appear-delay="' . $appear_delay . '"';
        }
        if (empty($images)) {
            echo '<div class="zn-pb-notification">Please configure the element options and create at least one link.</div>';
            return;
        }
        ?>


        <!--SECTION CONTENT-->
        <div class="fwCarouselContainer carouselContainer <?php 
        echo $this->data['uid'];
        ?>
" <?php 
        echo $appear;
        ?>
>
            <ul class="fwCarousel <?php 
        if ($use_popup) {
            echo 'magPopupUl';
        }
        ?>
" data-auto="<?php 
        echo $autoScroll;
        ?>
" data-duration="<?php 
        echo $timeout_duration;
        ?>
" data-count="<?php 
        echo $count;
        ?>
">

				<?php 
        foreach ($images as $image) {
            //$image_src = wp_get_attachment_image( $image['image'], 'image_gallery_large', false, array( 'class' => 'img-responsive animate' , 'data-mfp-src'=> wp_get_attachment_url( $image['image'] ) ) );
            $image_src = '';
            $image_attr = array('class' => 'img-responsive animate', 'data-mfp-src' => wp_get_attachment_url($image['image']));
            if (!$use_popup) {
                $image_attr = array('class' => 'img-responsive animate');
            }
            if ($custom_img_size) {
                $img_width = $this->opt('img_width', 660);
                $img_height = $this->opt('img_height', 420);
                $image_src = zn_get_image($image['image'], $img_width, $img_height, $image_attr);
            } else {
                $img_width = 1980 / $count - 60;
                //60 is the padding
                $image_src = zn_get_image($image['image'], $img_width, 0, $image_attr);
            }
            echo '<li class="scaleRotateImg">';
            echo $image_src;
            echo '</li>';
        }
        ?>
            </ul>
            <span class="Prev animate">
                <img alt="Previous" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/prev.png" /></span>
            <span class="Next animate">
                <img alt="Next" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/next.png" /></span>
        </div>
	<?php 
    }
예제 #3
0
function zn_gallery($atts)
{
    extract(shortcode_atts(array('order' => 'ASC', 'ids' => '', 'size' => 'col-sm-9', 'style' => 'thumbnails', 'columns' => 3), $atts));
    $output = '';
    $attachments = get_posts(array('include' => $ids, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => 'post__in'));
    if (!empty($attachments) && is_array($attachments)) {
        global $zn_config;
        if (!empty($zn_config['size'])) {
            $size = $zn_config['size'];
        }
        $size = zn_get_wp_image_size($size);
        $output = '<div class="post_media carouselContainer">';
        $output .= '	<ul class="galleryCarousel magPopupUl" data-gallery-columns="' . $columns . '">';
        foreach ($attachments as $attachment) {
            //$img      = wp_get_attachment_image( $attachment->ID , $size);
            $imgAttr = array('class' => "img-responsive animate");
            $img = zn_get_image($attachment->ID, $size['width'], $size['height'], $imgAttr, true);
            $output .= '<li class="scaleRotateImg">';
            $output .= $img;
            $output .= '</li>';
        }
        $output .= '	</ul>';
        $output .= '<span class="Prev animate"><img width="50" height="90" alt="Previous" src="' . THEME_BASE_URI . '/images/prev.png" /></span>';
        $output .= '<span class="Next animate"><img width="50" height="90" alt="Next" src="' . THEME_BASE_URI . '/images/next.png" /></span>';
        $output .= '</div>';
    }
    return $output;
}
예제 #4
0
    function element()
    {
        $laptop_image = $this->opt('laptop_image') ? $this->opt('laptop_image') : '';
        $tablet_image = $this->opt('tablet_image') ? $this->opt('tablet_image') : '';
        $phone_image = $this->opt('phone_image') ? $this->opt('phone_image') : '';
        $style = $this->opt('style') ? $this->opt('style') : '';
        if (empty($laptop_image) && empty($tablet_image) && empty($phone_image)) {
            echo '<div class="zn-pb-notification">Please configure the element options and add at least one device image.</div>';
            return;
        }
        $bkg1x = 687;
        $bkg1y = 434;
        $bkg2x = 273;
        $bkg2y = 363;
        $bkg3x = 146;
        $bkg3y = 254;
        if ($style === 'style2') {
            $bkg1x = 443;
            $bkg1y = 445;
            $bkg2x = 220;
            $bkg2y = 316;
            $bkg3x = 217;
            $bkg3y = 316;
            //$bkg1x = 468; $bkg1y = 445; $bkg2x = 196; $bkg2y = 265; $bkg3x = 196; $bkg3y = 270; //** Astea par mai bune
        }
        ?>

		<section class="devicesSection <?php 
        echo $style . ' ' . $this->data['uid'];
        ?>
">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="devices">
                            <?php 
        if (!empty($laptop_image)) {
            echo '<div class="laptop" data-appear="fade-in" data-appear-delay="500">';
            echo zn_get_image($laptop_image, $bkg1x, $bkg1y);
            echo '</div>';
        }
        if (!empty($tablet_image)) {
            echo '<div class="tablet" data-appear="fade-in" data-appear-delay="1000">';
            echo zn_get_image($tablet_image, $bkg2x, $bkg2y);
            echo '</div>';
        }
        if (!empty($phone_image)) {
            echo '<div class="phone" data-appear="fade-in" data-appear-delay="1500">';
            echo zn_get_image($phone_image, $bkg3x, $bkg3y);
            echo '</div>';
        }
        ?>

                        </div>
                    </div>
                </div>
            </div>
        </section>

	<?php 
    }