Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video section #14

Merged
merged 1 commit into from
Sep 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions wp-content/themes/Parallax-One/customizer_defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,16 @@ class DefSubscription {
public static $subtitle = 'Subscribe to our mailinglist to know about the notable updates to our cause';
public static $url = '';
public static $hide = true;
};

/*************************************************/
/*************** VIDEO SECTION *******************/
/*************************************************/

class DefVideo {
public static $video_link = 'https://www.youtube.com/embed/Rl-CLqAOSTs';
public static $video_caption = 'Would you enjoy such opportunity? Fill out our form below.';
public static $title = '4Water Journey';
public static $text = 'How it all started';
public static $hide = true;
};
5 changes: 5 additions & 0 deletions wp-content/themes/Parallax-One/front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
endif;
}

$parallax_one_video_show = get_theme_mod('parallax_one_video_show', DefVideo::$hide);
if (isset($parallax_one_video_show) && $parallax_one_video_show != 1):
array_push($not_hidden_sections, 'sections/parallax_one_video_section');
endif;

$parallax_one_call_to_action_show = get_theme_mod('parallax_one_call_to_action_show', DefCallToAction::$hide);
if (isset($parallax_one_call_to_action_show) && $parallax_one_call_to_action_show != 1):
array_push($not_hidden_sections, 'sections/parallax_one_call_to_action_section');
Expand Down
76 changes: 76 additions & 0 deletions wp-content/themes/Parallax-One/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,82 @@ function parallax_one_customize_register( $wp_customize ) {
'section' => 'why_us_section',
'priority' => 4,
));

/********************************************************/
/****************** VIDEO OPTIONS ***************/
/********************************************************/

$wp_customize->add_section('video_section', array(
'title' => esc_html__('Video section', 'parallax-one'),
'priority' => 32,
));

/* Video link */
$wp_customize->add_setting('video_link', array(
'default' => esc_html__(DefVideo::$video_link, 'parallax-one'),
'sanitize_callback' => 'parallax_one_sanitize_text',
'transport' => 'postMessage'
));
$wp_customize->add_control('video_link', array(
'label' => esc_html__('Video embed-link', 'parallax-one'),
'section' => 'video_section',
'active_callback' => 'parallax_one_show_on_front',
'priority' => 1
));

/* Video caption */
$wp_customize->add_setting('video_caption', array(
'default' => esc_html__(DefVideo::$video_caption, 'parallax-one'),
'sanitize_callback' => 'parallax_one_sanitize_text',
'transport' => 'postMessage'
));
$wp_customize->add_control('video_caption', array(
'label' => esc_html__('Video caption', 'parallax-one' ),
'section' => 'video_section',
'active_callback' => 'parallax_one_show_on_front',
'priority' => 1
));

/* Video title */
$wp_customize->add_setting('video_title', array(
'default' => esc_html__(DefVideo::$title,'parallax-one'),
'sanitize_callback' => 'parallax_one_sanitize_html',
'transport' => 'postMessage'
));
$wp_customize->add_control('video_title', array(
'label' => esc_html__('Video title', 'parallax-one'),
'section' => 'video_section',
'active_callback' => 'parallax_one_show_on_front',
'priority' => 2,
));

/* Video text */
$wp_customize->add_setting('video_text', array(
'default' => esc_html__(DefVideo::$text,'parallax-one'),
'sanitize_callback' => 'parallax_one_sanitize_html',
'transport' => 'postMessage'
));
$wp_customize->add_control('video_text', array(
'type' => 'textarea',
'label' => esc_html__('Video text', 'parallax-one'),
'section' => 'video_section',
'active_callback' => 'parallax_one_show_on_front',
'priority' => 2,
));

/* Video show/hide */

$wp_customize->add_setting('parallax_one_video_show', array(
'sanitize_callback' => 'parallax_one_sanitize_text',
'default' => DefVideo::$hide
));
$wp_customize->add_control(
'parallax_one_video_show', array(
'type' => 'checkbox',
'label' => __('Hide video section?', 'parallax-one'),
'section' => 'video_section',
'priority' => 3,
));

/********************************************************/
/*************** CALL TO ACTION OPTIONS *****************/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- =========================
SECTION: VIDEO
========================== -->
<?php
$video_link = get_theme_mod('video_link', DefVideo::$video_link);
$video_caption = get_theme_mod('video_caption', DefVideo::$video_caption);
$video_title = get_theme_mod('video_title', DefVideo::$title);
$video_text = get_theme_mod('video_text', DefVideo::$text);

if(!empty($video_link) ||
!empty($video_caption) ||
!empty($video_title) ||
!empty($video_text)) { ?>
<section class="video-section" id="video-section">
<div class="section-overlay-layer">
<div class="container">
<div id="video-container">
<!-- VIDEO TITLE -->
<h2 class="dark-text" id="video-title"><?php echo esc_attr($video_title) ?></h2>
<!-- VIDEO TEXT -->
<div class="subtitle"><?php echo $video_text ?></div>
<!-- VIDEO -->
<div id="video-container"> <?php
if (!empty($video_link)) { ?>
<iframe id="iframe-videosection-video" src="<?php echo esc_url($video_link) ?>" frameborder="0"
allowfullscreen></iframe>
<script type="text/javascript">
document.getElementById("iframe-videosection-video").src = document.getElementById("iframe-videosection-video").src;
</script> <?php
} ?>
</div> <?php

if (!empty($video_caption)) { ?>
<p id="video-caption"><?php echo esc_attr($video_caption) ?></p> <?php
} ?>
</div>
</div>
</div>
</section> <?php
} ?>
66 changes: 66 additions & 0 deletions wp-content/themes/Parallax-One/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,72 @@ img.why-us-img {
}
}

/*---------------------------------------
IMAGE SECTION
-----------------------------------------*/

section#video-section {
text-align: center;
background-color: #3a98cb;
color: white;
}

#video-section h2 {
padding-top: 20px;
padding-bottom: 10px;
color: white;
}

#video-section div.subtitle {
padding-bottom: 20px;
font-size: 1.0em;
margin: 0 150px;
}

#video-container {
padding-bottom: 15px;
}

@media only screen and (max-width: 800px) {
#video-section div.subtitle {
margin: 0 40px;
}
}

/* Video and keeping its aspect ratio */

iframe#iframe-videosection-video {
margin: auto;
margin-top: 0;
position: absolute;
display: block;
height: 100%;
width: 100%;
top: 0;
right: 0;
left: 0;
bottom: 0;
}

div#video-container {
position: relative;
padding-top: 0%;
padding-left: 5%;
padding-right: 5%;
min-height: 500px;
}

@media (max-width: 768px) {
div#video-container {
padding: 10%;
min-height: 180px;
}

iframe#iframe-videosection-video {
width: 90%;
}
}

/*---------------------------------------
CALL TO ACTION
-----------------------------------------*/
Expand Down