wordpress中的视频预卷vimeo

时间:2015-10-28 11:10:40

标签: javascript php wordpress vimeo

大家好我想将从github获取的开源代码集成到我的wordpress主题中。

链接:

Vimeo Pre-roll

这是我的video.php的代码,我想与vimeo合作。

代码:

<?php

get_header();

wize_set_views(get_the_ID());

echo '  
    <div id="wrap" class="fixed">';

if (have_posts())
    while (have_posts()):
        the_post();
        $social  = of_get_option('social_sng', '1') == '1';
        $venue   = get_post_meta($post->ID, 'vd_venue', true);
        $youtube = get_post_meta($post->ID, 'vd_youtube', true);
        $vimeo   = get_post_meta($post->ID, 'vd_vimeo', true);
        $date    = get_post_meta($post->ID, 'vd_date', true);
        $time    = strtotime($date);
        $year    = date('Y', $time);
        $month   = date('F', $time);
        $day     = date('d', $time);

        /* display */

        echo '
        <div id="mediasng">
            <div class="mediasng-title">
                <h1>' . get_the_title() . '</h1>
            </div><!-- end .mediasng-title -->
            <div class="mediasng-lv">
                ' . wize_like_info($post->ID) . '
                <div class="info-view">' . wize_get_views(get_the_ID()) . '</div>
            </div><!-- end .mediasng-lv -->
            <div class="mediasng-info">';
        if ($venue) {
            echo '
                <div class="mediasng-venue">' . esc_html($venue, "wizedesign") . '</div>';
        }
        if ($date) {
            echo '
                <div class="mediasng-date">' . esc_html($day, "wizedesign") . ' ' . esc_html($month, "wizedesign") . ' ' . esc_html($year, "wizedesign") . '</div>';
        }
        echo '
            </div><!-- end .mediasng-info -->';
        if ($youtube) {
            echo '
            <iframe src="https://www.youtube.com/embed/' . esc_attr($youtube) . '" width="1130" height="620" frameborder="0" allowfullscreen></iframe>';
        } elseif ($vimeo) {
            echo '
            <iframe src="http://player.vimeo.com/video/' . esc_attr($vimeo) . '" width="1130" height="620" frameborder="0" allowFullScreen></iframe>';
        }
        if ($social) {
            echo '
            <div class="mediasng-social">   
                <span>' . esc_html__("share", "wizedesign") . '</span>
                <a href="https://www.facebook.com/sharer/sharer.php?u=' . esc_url(get_permalink()) . '" target="_blank"><div class="sng-facebook"></div></a>
                <a href="https://twitter.com/home?status=' . esc_url(get_permalink()) . '" target="_blank"><div class="sng-twitter"></div></a>
                <a href="https://plus.google.com/share?url=' . esc_url(get_permalink()) . '" target="_blank"><div class="sng-google"></div></a>
                <a href="http://www.linkedin.com/shareArticle?mini=true&url=' . esc_url(get_permalink()) . '" target="_blank"><div class="sng-linkedin"></div></a>
            </div><!-- end .mediasng-social -->';
        }
        echo '  
    </div><!-- end .mediasng -->
    ';

    endwhile;

get_footer();

如何确保wordpress插件github读取代码?

0 个答案:

没有答案