Is it possible to let the video play by loading the homepage instead of clicking on a button, like currently the case is?

  1. Home
  2. Docs
  3. Khore
  4. Frequently Asked Question...
  5. Is it possible to let the video play by loading the homepage instead of clicking on a button, like currently the case is?

Is it possible to let the video play by loading the homepage instead of clicking on a button, like currently the case is?

Please install and activate child theme. Otherwise you will lose the changes when you upgrade the theme. Please read how to activate a Child-theme

Please copy front-page-content.php from the parent theme to the child theme.
On the child theme front-page-content.php
a) replace get_home_page_slider(); with get_childhome_page_slider();
b) search for the below code:
jQuery(‘.swiper-container’).parent(‘div’).addClass(‘index’);
c) replace this with:
jQuery(‘.swiper-container’).parent(‘div’).addClass(‘index’);
jQuery(window).load(function() {
jQuery(‘a.video-card__lnk’).click();
});

Update the file.

On the child theme functions.php file, please add the following

<?php

function get_childhome_page_slider() {
$ef_options = EF_Event_Options::get_theme_options();
$header_logo = !empty($ef_options[‘ef_header_logo’]) ? $ef_options[‘ef_header_logo’] : ”;
$image_ids = !empty($ef_options[‘ef_header_gallery’]) ? explode(‘,’, $ef_options[‘ef_header_gallery’]) : array();
$image_url = ”;
$video_markup = ”;
$videocontainer_color = !empty($ef_options[‘ef_videobutton_color’]) ? “style=”border-color: {$ef_options[‘ef_videobutton_color’]};”” : ”;
$videoicon_size = !empty($ef_options[‘ef_videobutton_color’]) ? “style=”color: {$ef_options[‘ef_videobutton_color’]};”” : ”;

if (!empty($ef_options[‘ef_header_video’])) {
/* $video_url = parse_url($ef_options[‘ef_header_video’]);
$video_id = explode(“=”, $video_url[‘query’]); */ //$video_id[1]
$video_markup = ‘<a class=”video-card__lnk” href=”#” data-video=”‘ . khore_get_video_embedded_url($ef_options[‘ef_header_video’]) . ‘?autoplay=1″ ‘ . $videocontainer_color . ‘>
<i class=”fa fa-play fa-5x” ‘ . $videoicon_size . ‘></i>
</a>’;
}
$event_title = !empty($ef_options[‘ef_herotitle’]) ? $ef_options[‘ef_herotitle’] : ”;
$event_s_title = !empty($ef_options[‘ef_herosubtitle’]) ? $ef_options[‘ef_herosubtitle’] : ”;
$date_n_time = !empty($ef_options[‘ef_datetimeplace’]) ? $ef_options[‘ef_datetimeplace’] : ”;
$registration_btn = ”;
$html = ”;
if (isset($ef_options[‘ef_home_show_register_btn’])) {
$button_font_size = !empty($ef_options[‘ef_home_registerbutton_font_size’]) ? “font-size: {$ef_options[‘ef_home_registerbutton_font_size’]};” : ”;
$button_text_color = !empty($ef_options[‘ef_home_registerbutton_color’]) ? “color: {$ef_options[‘ef_home_registerbutton_color’]};” : ”;
$button_border_color = !empty($ef_options[‘ef_home_registerbutton_color’]) ? “border-color: {$ef_options[‘ef_home_registerbutton_color’]};” : ”;
$button_style = ”;

if (!empty($button_font_size) || !empty($button_text_color)) {
$button_style = “style=”$button_font_size $button_text_color $button_border_color””;
}

$registration_btn = ‘<a href=”‘ . $ef_options[‘ef_home_registerbtnurl’] . ‘” title=”‘ . stripslashes($ef_options[‘ef_home_registerbtntext’]) . ‘” class=”video-card__reg” ‘ . $button_style . ‘>’ . $ef_options[‘ef_home_registerbtntext’] . ‘</a>’;
}
$header_logo_item = ”;
if (!empty($header_logo)) {
if (isset($ef_options[‘ef_logo_remove_size’])) {
$header_logo_size = ”;
} else {
$header_logo_size = ‘width=”300″ height=”101″‘;
}
$header_logo_item = ‘<img src=”‘ . $header_logo . ‘”‘ . $header_logo_size . ‘ alt=”‘ . get_bloginfo(‘name’) . ‘”>’;
}
$event_title_color = !empty($ef_options[‘ef_herotitle_color’]) ? “color:{$ef_options[‘ef_herotitle_color’]};” : ”;
$event_subtitle_color = !empty($ef_options[‘ef_herosubtitle_color’]) ? “color:{$ef_options[‘ef_herosubtitle_color’]};” : ”;
$event_datetime_color = !empty($ef_options[‘ef_datetimeplace_color’]) ? “color:{$ef_options[‘ef_datetimeplace_color’]};” : ”;
$event_title_size = !empty($ef_options[‘ef_herotitle_font_size’]) ? “font-size:{$ef_options[‘ef_herotitle_font_size’]};” : ”;
$event_subtitle_size = !empty($ef_options[‘ef_herosubtitle_font_size’]) ? “font-size:{$ef_options[‘ef_herosubtitle_font_size’]};” : ”;
$event_datetime_size = !empty($ef_options[‘ef_datetimeplace_font_size’]) ? “font-size:{$ef_options[‘ef_datetimeplace_font_size’]};” : ”;

$title_style = ”;
$subtitle_style = ”;
$date_style = ”;

if (!empty($event_title_color) || !empty($event_title_size)) {
$title_style = “style=”$event_title_color $event_title_size””;
}
if (!empty($event_subtitle_color) || !empty($event_subtitle_size)) {
$subtitle_style = “style=”$event_subtitle_color $event_subtitle_size””;
}
if (!empty($event_datetime_color) || !empty($event_datetime_size)) {
$date_style = “style=”$event_datetime_color $event_datetime_size””;
}

if (!empty($image_ids)) {
foreach ($image_ids as $image) {
$image_url = wp_get_attachment_image_src($image, ‘full’);
$html = $html . ‘<div class=”swiper-slide”>
<div class=”video-card” style=”background-image:url(‘ . $image_url[0] . ‘);”>
<div>
<div>
<h2 class=”video-card__title”>’ .
$header_logo_item .
“<span $title_style>” . stripslashes($event_title) . ‘</span>
</h2>
<p ‘ . $subtitle_style . ‘>’ . stripslashes($event_s_title) . ‘</p>
‘ . $video_markup . ‘
<div class=”video-card__place”‘ . $date_style . ‘>
‘ . stripslashes($date_n_time) . ‘
</div>
‘ . $registration_btn . ‘
</div>
</div>
</div>
</div>’;
}
}
return ‘<div class=”swiper-wrapper”>’ . $html . ‘</div>’;
}

Update the file.

Was this article helpful to you? Yes No