Beispiel #1
0
/**
 * Add data to the vcex_gitem_post_video shortcode
 *
 * @since 1.4.1
 */
function vc_gitem_template_attribute_vcex_post_video($value, $data)
{
    // Extract data
    extract(array_merge(array('output' => '', 'post' => null, 'data' => ''), $data));
    // Get and extract shortcode attributes
    $atts = array();
    parse_str($data, $atts);
    extract(shortcode_atts(array('post_id' => '', 'css' => ''), $atts));
    // Get post id
    $post_id = !empty($post_id) ? $post_id : $post->ID;
    // Get video
    $video = wpex_get_post_video($post_id);
    $video = $video ? wpex_get_post_video_html($video) : '';
    if ($video) {
        // Custom CSS
        if ($css) {
            $css = ' ' . vc_shortcode_custom_css_class($css);
        }
        // Generate output
        $output .= '<div class="vcex-gitem-post-video wpex-clear' . $css . '">';
        $output .= $video;
        $output .= '</div><!-- .vcex-gitem-post-video -->';
        // Return output
        return $output;
    }
}
Beispiel #2
0
 function wpex_get_portfolio_featured_video_url($post_id = '')
 {
     if (function_exists('wpex_post_video')) {
         return wpex_get_post_video($post_id);
     }
 }
 $get_post = get_post();
 // Post Data
 $post->ID = $get_post->ID;
 $post->title = $get_post->post_title;
 $post->permalink = wpex_get_permalink($post->ID);
 $post->format = get_post_format($post->ID);
 $post->excerpt = '';
 // Post Excerpt
 if ('true' == $excerpt) {
     $post->excerpt = wpex_get_excerpt(array('length' => intval($excerpt_length)));
 }
 // Counter
 $count++;
 // Get video
 if ('video' == $post->format) {
     $post->video = wpex_get_post_video($post->ID);
     $post->video_oembed = wpex_get_post_video_html($post->video);
 }
 // Entry Classes
 $entry_classes = array('vcex-blog-entry');
 $entry_classes[] = 'span_1_of_' . $columns;
 $entry_classes[] = 'col-' . $count;
 if ('false' == $columns_responsive) {
     $entry_classes[] = 'nr-col';
 } else {
     $entry_classes[] = 'col';
 }
 if ($is_isotope) {
     $entry_classes[] = 'vcex-isotope-entry';
 }
 if ($css_animation) {
Beispiel #4
0
/**
 * Returns post video HTML
 *
 * @since 2.0.0
 */
function wpex_get_post_video_html($video = '')
{
    // Get video
    $video = $video ? $video : wpex_get_post_video();
    // Return if video is empty
    if (empty($video)) {
        return;
    }
    // Check post format for standard post type
    if ('post' == get_post_type() && 'video' != get_post_format()) {
        return;
    }
    // Get oembed code and return
    if (!is_wp_error($oembed = wp_oembed_get($video)) && $oembed) {
        return '<div class="responsive-video-wrap">' . $oembed . '</div>';
    } else {
        $video = apply_filters('the_content', $video);
        // Add responsive video wrap for youtube/vimeo embeds
        if (strpos($video, 'youtube') || strpos($video, 'vimeo')) {
            return '<div class="responsive-video-wrap">' . $video . '</div>';
        } else {
            return $video;
        }
    }
}