Example #1
0
function be_flex_slide($atts, $content)
{
    extract(shortcode_atts(array('image' => '', 'video' => '', 'title' => '', 'caption' => '', 'show_title' => 'no', 'show_caption' => 'no', 'size' => 'full'), $atts));
    $output = '';
    $output .= '<li>';
    if (!empty($video)) {
        $videoType = be_themes_video_type($video);
        if ($videoType == "youtube") {
            if (preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $video, $match)) {
                $video_id = $match[1];
            }
            $output .= '<iframe width="940" height="450" src="http://www.youtube.com/embed/' . $video_id . '" allowfullscreen></iframe>';
        } elseif ($videoType == "vimeo") {
            sscanf(parse_url($video, PHP_URL_PATH), '/%d', $video_id);
            $output .= '<iframe src="http://player.vimeo.com/video/' . $video_id . '" width="500" height="281" allowFullScreen></iframe>';
        }
    } else {
        if (!empty($image)) {
            // check if the post has a Post Thumbnail assigned to it.
            $attachment_info = wp_get_attachment_image_src($image, $size);
            $attachment_url = $attachment_info[0];
            $output .= '<img src="' . $attachment_url . '" alt="" />';
        }
    }
    if ($show_title == 'yes') {
        $title = '<h4 class="flex-slide-title alt_bg_color">' . $title . '</h4>';
    }
    if ($show_caption == 'yes') {
        $caption = '<p>' . $caption . '</p>';
    }
    if ($show_title == 'yes' || $show_caption == 'yes') {
        $output .= '<div class="flex-caption">' . $title . $caption . '</div>';
    }
    $output .= '</li>';
    return $output;
}
Example #2
0
<?php

global $blog_style;
?>
		
<div class="post-thumb <?php 
echo 'style-' . $blog_style;
?>
">
	<div class="thumb-wrap">
		<?php 
$video_url = get_post_meta(get_the_ID(), 'be_themes_video_url', true);
if (!empty($video_url)) {
    $video_type = be_themes_video_type($video_url);
    if (!empty($video_type)) {
        echo do_shortcode('[video source="' . $video_type . '" url="' . $video_url . '"]');
    }
}
?>
	</div>
</div>