Итак, у меня установлен плагин Custom Forms, и эти пользовательские формы в основном представляют собой текстовые редакторы, которые появляются на каждом пользовательском портале в левой вкладке Users. Встраивание видео отлично работает, поэтому мне это нужно (разные видео каждого пользователя), но по какой-то причине я не могу добавить более 1 видео на страницу.
(Straddle, follow up, hip extension и т. Д. - все названия страниц, на которых должен отображаться список воспроизведения видео.)
<?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(); ?>
ОШИБКИ КОНСОЛИ
JQMIGRATE: Миграция установлена, версия 1.4.1
? lesson = 570 & lessonname = Hip-Extension & vimeography_gallery = 7 & vimeography_video = 310906063: 1 Не проверено runtime.lastError: Порт сообщения закрыт до получения ответа.
3vue.esm.js: 8651 Vimeography: прогресс галереи составляет 0,1126005361930295
fresnel.vimeocdn.com/add/player-stats?session-id=27bc08551410cb3482978a833950cc8826d552d51557937629:1 Не удалось загрузить ресурс: net :: ERR_BLOCKED_BY_CLIENT
2? Lesson = 570 & lessonname = Hip-Extension & vimeography_gallery = 7 & vimeography_video = 310906063: 1 Uncaught SyntaxError: Неожиданный токен;
fresnel.vimeocdn.com/add/player-stats?session-id=27bc08551410cb3482978a833950cc8826d552d51557937629:1 Не удалось загрузить ресурс: net :: ERR_BLOCKED_BY_CLIENT
vue.esm.js: 8651 Vimeography: прогресс галереи составляет 0,1126005361930295