Exemplo n.º 1
0
    function widget($args, $instance)
    {
        extract($args);
        // Our variables from the widget settings
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        $vid = isset($instance['vid']) ? esc_attr($instance['vid']) : '';
        $desc = isset($instance['desc']) ? esc_attr($instance['desc']) : '';
        // Before widget (defined by theme functions file)
        echo $before_widget;
        // Display the widget title if one was input
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        //Parse the content for the first occurrence of video url
        $video = ep_extract_video_info($vid);
        if ($video != null) {
            $w = 270;
            $h = 151;
            ep_get_video_meta($video);
            if (array_key_exists('width', $video)) {
                $w = $video['width'];
                $h = $video['height'];
            }
            //Extract video ID
            ?>
            <div class="video-frame">
                <?php 
            if ($video['type'] == 'youtube') {
                $src = "http://www.youtube.com/embed/" . $video['id'];
            } else {
                $src = "http://player.vimeo.com/video/" . $video['id'] . "?color=ff4c2f";
            }
            ?>
                <iframe src="<?php 
            echo esc_url($src);
            ?>
" width="<?php 
            echo esc_attr($w);
            ?>
" height="<?php 
            echo esc_attr($h);
            ?>
" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
            </div>
        <?php 
        }
        if (esc_attr($desc) != '') {
            ?>
            <div class="video-description"><?php 
            echo esc_attr($desc);
            ?>
</div>
        <?php 
        }
        // After widget (defined by theme functions file)
        echo $after_widget;
    }
Exemplo n.º 2
0
<?php

get_template_part('templates/loop', "blog-meta");
?>
<div class="post-content">
    <?php 
//Parse the content for the first occurrence of video url
$video = ep_extract_video_info(get_post_meta(get_the_ID(), 'video-id', true));
if ($video != null) {
    $w = 500;
    $h = 280;
    ep_get_video_meta($video);
    if (array_key_exists('width', $video)) {
        $w = $video['width'];
        $h = $video['height'];
    }
    //Extract video ID
    ?>
        <div class="post-media video-frame">
        <?php 
    if ($video['type'] == 'youtube') {
        $src = "http://www.youtube.com/embed/" . $video['id'];
    } else {
        $src = "http://player.vimeo.com/video/" . $video['id'] . "?color=ff4c2f";
    }
    ?>
        <iframe src="<?php 
    echo esc_url($src);
    ?>
" width="<?php 
    echo esc_attr($w);
Exemplo n.º 3
0
<?php

//check social share is Enable or not
$socialshare = get_post_meta(get_the_ID(), "post-social-share", true);
?>
<div <?php 
post_class();
?>
>
    <div class="post-media">

        <?php 
//Parse the content for the first occurrence of video url
$video = ep_extract_video_info(ep_get_meta('video-id'));
if ($video != null) {
    $w = 500;
    $h = 280;
    ep_get_video_meta($video);
    if (array_key_exists('width', $video)) {
        $w = $video['width'];
        $h = $video['height'];
    }
    //Extract video ID
    ?>
            <div class="post-media video-frame">
                <?php 
    if ($video['type'] == 'youtube') {
        $src = "http://www.youtube.com/embed/" . $video['id'];
    } else {
        $src = "http://player.vimeo.com/video/" . $video['id'] . "?color=ff4c2f";
    }