function ew_img_video($atts)
 {
     extract(shortcode_atts(array('src_thumb' => '', 'src_zoom_img' => '', 'link_video' => '', 'width_thumb' => '190', 'height_thumb' => '103', 'type' => '', 'use_lightbox' => 'true', 'custom_link' => '#', 'class' => '', 'title' => ''), $atts));
     $width_div = $width_thumb + 8;
     $height_div = $height_thumb + 8;
     $left_fancy = floor(($width_div - 30) / 2);
     $top_fancy = floor(($height_div - 30) / 2);
     $result = "<div class='image-style {$class}' style='width:{$width_div}px;height:{$height_div}px'>";
     if ($type == 'video') {
         if ($link_video) {
             if (strstr($link_video, 'youtube.com') || strstr($link_video, 'youtu.be')) {
                 $class_fancy = ' youtube';
                 $big_video_url = 'http://www.youtube.com/watch?v=' . wp_parse_youtube_link($link_video);
             } else {
                 $class_fancy = 'vimeo';
                 $big_video_url = $link_video;
             }
             $result .= "<a class='thumbnail' href='" . $custom_link . "' style='width:{$width_thumb}px;height:{$height_thumb}px'>" . get_thumbnail_video($link_video, $width_thumb, $height_thumb) . "</a>";
             if ($use_lightbox == 'true') {
                 $result .= "<div class='fancybox_container' style='display:none;' id='img-video-" . rand(0, 1000) . "{$width_thumb}{$height_thumb}'>\n\t\t\t\t\t\t\t<a title='{$title}' class='fancybox_control {$class_fancy}' href='{$big_video_url}' style='left:{$left_fancy}px;top:{$top_fancy}px'>Lightbox</a>\n\t\t\t\t\t\t</div>";
             }
         }
     } else {
         if ($src_thumb) {
             $result .= "<a href='{$custom_link}' class='thumbnail' style='width:{$width_thumb}px;height:{$height_thumb}px'><img width='{$width_thumb}' height='{$height_thumb}' src='{$src_thumb}'/></a>";
         }
         if ($src_zoom_img && $use_lightbox == 'true') {
             $result .= "<div class='fancybox_container' style='display:none;' id='img-video-" . rand(0, 1000) . "{$width_thumb}{$height_thumb}'>\n\t\t\t\t\t\t<a title='{$title}' class='fancybox_control' href='{$src_zoom_img}' style='left:{$left_fancy}px;top:{$top_fancy}px'>Lightbox</a>\n\t\t\t\t\t</div>";
         }
     }
     $result .= "</div>";
     return $result;
 }
Example #2
0
 function ew_lightbox($atts)
 {
     extract(shortcode_atts(array('href' => '', 'title' => 'Lightbox', 'group' => '', 'photo' => '', 'lb_with' => 'text', 'use_iframe' => 'false', 'width' => 150, 'height' => 150, 'button_text' => __('Lightbox Button', 'wpdance')), $atts));
     $rel = !empty($group) ? " rel='{$group}'" : '';
     $iframe_class = $use_iframe == 'true' ? " iframe" : '';
     // Parse href for youtube, vimeo or image
     if (strstr($href, 'youtube.com') || strstr($href, 'youtu.be')) {
         $class_fancy = ' youtube';
         if (wp_parse_youtube_link($href)) {
             $big_url = 'http://www.youtube.com/watch?v=' . wp_parse_youtube_link($href);
         } else {
             $big_url = $href;
         }
     } elseif (strstr($href, 'vimeo.com')) {
         $class_fancy = ' vimeo';
         $big_url = $href;
     } else {
         $class_fancy = '';
         $big_url = $href;
     }
     if ($use_iframe == 'true') {
         $class_fancy = '';
     }
     if ($lb_with == 'text') {
         return "<a class='lb_control{$class_fancy}{$iframe_class}' href='{$big_url}'{$rel} title='{$title}'>{$title}</a>";
     } elseif ($lb_with == 'img') {
         if ($photo) {
             return "<a class='lb_control{$class_fancy}{$iframe_class}' href='{$big_url}'{$rel} title='{$title}'><img src='{$photo}'/></a>";
         } else {
             return "<a class='lb_control{$class_fancy}{$iframe_class}' href='{$big_url}'{$rel} title='{$title}'>" . get_thumbnail_video($href, $width, $height) . "</a>";
         }
     } elseif ($lb_with == 'button') {
         return "<a class='btn_lightbox lb_control{$class_fancy}{$iframe_class}' href='{$big_url}'{$rel} title='{$title}'><span><span>" . $button_text . "</span></span></a>";
     }
 }
    function show_light_box($post, $class_fancy, $rel = '', $id = '', $begin_show = false)
    {
        // Get link lightbox for image or video (youtube or vimeo)
        if ($video_link = get_post_meta($post->ID, THEME_SLUG . 'video_portfolio', true)) {
            $thumbnail = get_thumbnail_video($video_link, $width_thumb, $height_thumb);
            if (strstr($video_link, 'youtube.com') || strstr($video_link, 'youtu.be')) {
                $class_fancy .= ' youtube';
                $big_image_url = 'http://www.youtube.com/watch?v=' . wp_parse_youtube_link($video_link);
            } else {
                $class_fancy .= ' vimeo';
                $big_image_url = $video_link;
            }
        } else {
            $big_image_id = get_post_thumbnail_id($post->ID);
            $big_image_url = wp_get_attachment_image_src($big_image_id, 'full');
            $big_image_url = $big_image_url[0];
        }
        ?>
		<div class="fancybox_container"<?php 
        if ($id) {
            echo " id='{$id}'";
        }
        if (!$begin_show) {
            echo " style='display:none'";
        }
        ?>
>
			<a class="<?php 
        echo $class_fancy;
        ?>
 fancybox_control" title="<?php 
        echo get_the_title($post->ID);
        ?>
" <?php 
        if ($rel) {
            echo "rel='{$rel}'";
        }
        ?>
 href="<?php 
        echo $big_image_url;
        ?>
"><?php 
        _e('LightBox', 'wpdance');
        ?>
</a>
		</div>	
		<?php 
    }
Example #4
0
    function quicksand_filter()
    {
        wp_reset_query();
        if ($_POST['filter'] == 'all') {
            $num_post = count(query_posts('post_type=' . $_POST['post_type'] . '&posts_per_page=' . $_POST['num_posts_per_page'] . '&paged=' . $_POST['page']));
        } else {
            $num_post = count(query_posts('meta_key=' . THEME_SLUG . 'type_portfolio&meta_value=' . $_POST['filter'] . '&post_type=' . $_POST['post_type'] . '&posts_per_page=' . $_POST['num_posts_per_page'] . '&paged=' . $_POST['page']));
        }
        $column_count = $_POST['column_count'];
        $width_thumb = $_POST['width_thumb'];
        $height_thumb = $_POST['height_thumb'];
        $i = 0;
        ?>
		<ul class="list-post">
		<?php 
        while (have_posts()) {
            the_post();
            global $post;
            $thumbnail = get_thumbnail($width_thumb, $height_thumb, '', get_the_title(), get_the_title());
            $thumb = $thumbnail["fullpath"];
            ?>
			<li class="item<?php 
            if ($i % $column_count == 0) {
                echo ' start';
            }
            if (++$i % $column_count == 0 || $i == $num_post) {
                echo ' end';
            }
            ?>
" data-id="<?php 
            echo $post->ID;
            ?>
" title="<?php 
            echo $i;
            ?>
">
				<?php 
            if ($thumb || ($video_link = get_post_meta($post->ID, THEME_SLUG . 'video_portfolio', true))) {
                ?>
				<div class="image image-style">
					<a class="thumbnail" href="<?php 
                the_permalink();
                ?>
">
						<?php 
                if ($thumb) {
                    the_post_thumbnail(array($width_thumb, $height_thumb), array('class' => 'thumbnail-effect-1'));
                } else {
                    echo get_thumbnail_video($video_link, $width_thumb, $height_thumb);
                }
                ?>
					</a>
					<?php 
                if ($_POST['lightbox'] == 'true') {
                    if ($video_link) {
                        show_light_box($post, 'fancybox-group', '', $_POST['id_group'] . '-' . $post->ID);
                    } else {
                        show_light_box($post, 'fancybox-group', 'lightbox-' . $_POST['id_group'], $_POST['id_group'] . '-' . $post->ID);
                    }
                }
                ?>
				</div>
				<?php 
            }
            ?>
				<div class="detail<?php 
            if (!$thumb && !$video_link) {
                echo ' noimage';
            }
            ?>
">
					<h2 class="entry-title"><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            printf(esc_attr__('Permalink to %s', 'wpdance'), the_title_attribute('echo=0'));
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a></h2>
					<div class="entry-content">
						<?php 
            the_excerpt_max_charlength(250);
            ?>
					</div><!-- .entry-content -->
					<a href="<?php 
            the_permalink();
            ?>
" class="read-more-btn button"><span><span><?php 
            _e('Read more', 'wpdance');
            ?>
</span></span></a>
				</div>
			</li>
		<?php 
        }
        ?>
		</ul>

		<?php 
        wp_reset_query();
    }