dtdvbf37193 2019-05-15 04:48
浏览 139

尝试在页面上嵌入多个视频,但无论我尝试什么,都只会出现1个视频

So I have Custom Forms plugin installed and these custom forms are mostly text editors that appear in each users portal in the Users left tab area. Embedding videos work great, which is why I need this (different videos of each user) but for some reason I can't add more than 1 video on the page.

(Straddle, follow along, hip extension, etc are all names of pages that the video playlist needs to appear in.)

<?php /*Template Name: following-temp */
$userID=get_current_user_id();
?>
<?php if(isset($_GET['lesson'])){
$lesson_id = $_GET['lesson'];
$lesson_name = $_GET['lessonname']; } ?>
<?php get_header(); ?>
<style>
    .embed-container { position: relative; padding-bottom: 56.25%; 
height: 0; overflow: hidden; max-width: 100%; }
    .embed-container iframe,
    .embed-container object,
    .embed-container embed { position: absolute; top: 0; left: 0; 
width: 100%; height: 100%; }
</style>
<div class="container">
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header"><?php the_title(); ?></h1>
        <ol class="breadcrumb">
            <li><a href="/">Home</a></li>
            <li><a href="/courses/myflex/">Return to Modules</a> . 
</li>
            <li><a href="/myflexibility-profile/">MyFLEXibility 
 Profile</a></li>
            <li><?php the_title(); ?></li>
        </ol>
    </div>
    <?php
    $post_thumbnail = get_the_post_thumbnail( $lesson_id );
    echo "<div class='col-lg-8'>";
    $title =  get_the_title($lesson_id);
    if ('Warm-Ups' == $lesson_name) {
        $title = 'Warm Ups';
    }
    if ('Cool-Down' == $lesson_name) {
        $title = 'Cool Down';
    }
    echo "<h2 class='title'>" . $title . "</h2>";
    echo "<div class='embed-container'>";
    /*
    if warm up is requested to add again, uncomment this one
    if($lesson_id  == 570){
        $post_12 = get_post(2285); 
        echo "<h2 class='fav'> Warm up <h2>";
        $trim_me = $post_12->post_content;
        echo $trim_me;
    } */
  //        echo get_field("follow_along_video",$lesson_id);
    if ('Warm-Ups' == $lesson_name) {
        ?>
        <iframe src="https://player.vimeo.com/video/311167472" 
 width="640" height="360" frameborder="0" webkitallowfullscreen 
mozallowfullscreen allowfullscreen></iframe>
        <?php
    }
    if ('Hip-Extension' == $lesson_name) {
        the_field('followalong_-_hip_extension_video_embed', 
 'user_'.get_current_user_id());
    }
    if ('Pike' == $lesson_name) {
        the_field('followalong_-_pike_video_embed', 
 'user_'.get_current_user_id());
    }
    if ('Straddle' == $lesson_name) {
        the_field('followalong_-_straddle_video_embed', 
 'user_'.get_current_user_id());
    }
    if ('Shoulders-and-Upper-Back' == $lesson_name) {
        the_field('followalong_-_shoulders_video_embed', 
 'user_'.get_current_user_id());
    }
    if ('Cool-Down' == $lesson_name) {
        ?>
        <iframe src="https://player.vimeo.com/video/311167475" 
  width="640" height="360" frameborder="0" webkitallowfullscreen 
 mozallowfullscreen allowfullscreen></iframe>
        <?php
    }
    echo "</div>";
    echo "</div>";
    ?>
    <div class="col-lg-4">
        <div class="hidden-md hidden-lg" style="width:100%; 
  height:40px;"><hr></div>
        <div class="well well-sidebar-rep2"><h4>Navigation</h4>
            <div id="course_navigation" class="course_navigation">
                <div class="ld-course-navigation-widget-content- 
 contaiiner">
                    <div 
 class="learndash_navigation_lesson_topics_list">
                        <div class="inactive" id="lesson_list-568">
                            <div class="list_arrow collapse 
  lesson_incomplete"></div>
                            <div class="list_lessons">
                                <div class="lesson ">
                                    <a href="/my-video-single/? 
   single=follow-along">Return to Categories</a>
                                </div>
                            </div>
                        </div>
                        <div class="inactive" id="lesson_list-569">
                            <div class="list_arrow collapse 
   lesson_incomplete">
                            </div>
                            <div class="list_lessons">
                                <div class="lesson">
                                    <a 
   href="/courses/myflex/">Return to Modules</a>
                                </div>
                            </div>
                        </div>
                        <div class="inactive" id="lesson_list-570">
                            <div class="list_arrow collapse 
    lesson_incomplete"></div>
                            <div class="list_lessons">
                                <div class="lesson ">
                                    <a href="/myflexibility- 
   profile/">Return to MyFLEX</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="widget_course_return">
                        Return to <a href="<?php echo home_url(); ? 
     >">HOME</a>
                    </div>
                </div>
            </div> <!-- Closing <div id='course_navigation'> -->
        </div>
    </div>
    <?php
    echo "<div class='col-lg-8' style='margin-bottom:100px'>";
    $all_lesson = $wpdb->get_results("SELECT 
    result_data,quiz_id,result_percentage FROM `wp_custom_learndash` 
     WHERE `lesson_id` = $lesson_id AND user_id = $userID ORDER BY 
    `id` ASC");
    $array_type_vid = [];
    $result_percentage = [];
    $iter=0;
    foreach ($all_lesson as $key=>$value_lesson) {
        $result_percentage[$value_lesson->quiz_id] = $value_lesson- 
    >result_percentage;
        $data_vid =  json_decode($value_lesson->result_data);
        $quiz_id = $value_lesson->quiz_id;
        $dom = new DOMDocument;
        if (strpos($data_vid->data, 'class') !== false) {
            $dom->loadHTML($data_vid->data);            
            foreach($dom->getElementsByTagName('div') as $node){
            $array_type_vid[$quiz_id][$iter][$node- 
     >getAttribute('class')] = $dom->saveHTML($node);
            $iter++;
            }
        }else{
             $data_vid =  json_decode($value_lesson->result_data);
             if($data_vid->data !== 0){
                echo $data_vid->data."<br>";
            }
        }
    }

    #generating the videos here
    foreach ($array_type_vid as $qkey => $value) {
        foreach ($value as $nkey => $item) {
            #default follow along results
            if (array_key_exists("follow_along",$item)){
                echo  "<div class='ins- 
    vid'>".$item['follow_along']."</div>";
            }
        }
        #default test value
        $qkey_data = get_field( 
     "follow_along_video_test_default",$qkey);
        echo $qkey_data;  
        #for pike active passive test solution  
        if($qkey == 1339){
            if($result_percentage[$qkey] >= 80){
                echo  get_field( "pike_more_80_follow_along",$qkey);
            }elseif($result_percentage[$qkey] < 80){
                echo   get_field( 
   "pike_less_80_follow_along",$qkey);
            }
        }
        #for straddle extra video
        if($qkey == 1473){
            if($result_percentage[$qkey] >= 100){
                echo  get_field( 
 "straddle_over_100_follow_along",$qkey);
            }elseif($result_percentage[$qkey] < 100){
                echo   get_field( 
 "straddle_less_100_follow_along",$qkey);
            }
        }
    }
   /* 
    if cool down is requested to add again, uncomment this one
   if($lesson_id == 1325){
        $post_12 = get_post(2287); 
        echo "<h2 class='fav'> Cool Down </h2>";
        $trim_me = $post_12->post_content;
        echo $trim_me;
    } */ 
    ?>
</div>
</div>
<style type="text/css">
h2:not(.title){
    font-size: 20px !important;
    font-weight: 600 !important;
    padding-left: 45px !important;
}
</style>
<?php get_footer(); ?>

CONSOLE ERRORS

JQMIGRATE: Migrate is installed, version 1.4.1 ?lesson=570&lessonname=Hip-Extension&vimeography_gallery=7&vimeography_video=310906063:1 Unchecked runtime.lastError: The message port closed before a response was received. 3vue.esm.js:8651 Vimeography: gallery progress is 0.1126005361930295 fresnel.vimeocdn.com/add/player-stats?session-id=27bc08551410cb3482978a833950cc8826d552d51557937629:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT 2?lesson=570&lessonname=Hip-Extension&vimeography_gallery=7&vimeography_video=310906063:1 Uncaught SyntaxError: Unexpected token ; fresnel.vimeocdn.com/add/player-stats?session-id=27bc08551410cb3482978a833950cc8826d552d51557937629:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT vue.esm.js:8651 Vimeography: gallery progress is 0.1126005361930295

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 Revit2020下载问题
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线