deadpan_guy.php
11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
/**
* The template for displaying the Deadpan Guy page .
*
* Template name: Deadpan Guy
*
* @package storefront
*/
/**
*
* @author Ho Ngoc Hang<kemly.vn@gmail.com>
*/
remove_filter('the_content', 'wpautop');
get_header();
$first_video_id = get_first_video();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php
do_action('storefront_page_before');
?>
<div id="top-panel">
<div class="col-full">
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/deadpan-mobile.png' ?>" alt="" class="col-md-7 deadpan-mobile" />
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/deadpan-desktop.png' ?>" alt="" class="col-md-7 deadpan-desktop" />
<div class="mobile-reg-text">
<span><b>WIN</b> A 3 MONTH SUPPLY</span>
</div>
<div class="welcome-form col-md-4">
<!--<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/welcome-1.png' ?>" alt="" />-->
<p class="text-welcome">WELCOME TO THE HOME OF DEADPAN GUY</p>
<p class="text-win">WIN</p>
<p class="desktop">A 3 MONTH SUPPLY</p>
<p class="normal-text">Enter your details for the chance to win a 3 month's supply of REIZE. Winners notified by email every 3 months and announced on social media.</p>
<?php if (!empty($_REQUEST['ac-thank-you']) && $_REQUEST['ac-thank-you'] == 1) { ?>
<div id="deadpan_thank_text">THANKS! THE WINNER WILL BE DRAWN ON 31ST MAY, 2017 AND NOTIFIED BY EMAIL.</div>
<?php } else { ?>
<form action="https://reizeenergydrink.activehosted.com/proc.php" method="POST" id="deadpan_form">
<input type="hidden" name="u" value="3" class="dpform_not_include" />
<input type="hidden" name="f" value="3" class="dpform_not_include"/>
<input type="hidden" name="s" class="dpform_not_include"/>
<input type="hidden" name="c" value="0" class="dpform_not_include"/>
<input type="hidden" name="m" value="0" class="dpform_not_include"/>
<input type="hidden" name="act" value="sub" class="dpform_not_include"/>
<input type="hidden" name="v" value="2" class="dpform_not_include"/>
<div>
<input type="text" name="fullname" value="" placeholder="First Name" id="deadpan_fullname" class="deadpan_input" />
<span class="error">* This is a required field</span>
</div>
<div>
<input type="text" name="email" value="" placeholder="Email" id="deadpan_email" class="deadpan_input" />
<span class="error">* Email address is not valid </span>
</div>
<input type="submit" name="submit_deadpan_guy" value="enter now" class="button btnrow" class="dpform_not_include"/>
<p id="dp_term_text">* By clicking "enter now" you accept our <a href='https://reize.com.au/legal-terms/'>terms</a>.</p>
</form>
<script>
jQuery(document).ready(function ($) {
$('#deadpan_form #deadpan_fullname').on('input', function () {
var input = $(this);
var is_name = input.val();
if (is_name) {
input.removeClass("invalid").addClass("valid");
} else {
input.removeClass("valid").addClass("invalid");
}
});
$('#deadpan_form #deadpan_email').on('input', function () {
var input = $(this);
// var re = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
var re = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var is_email = re.test(input.val());
if (is_email) {
input.removeClass("invalid").addClass("valid");
} else {
input.removeClass("valid").addClass("invalid");
}
});
$('#deadpan_form input[name="submit_deadpan_guy"]').click(function (event) {
var form_data = $("#deadpan_form").find(':input').not(".dpform_not_include").serializeArray();
var error_free = true;
for (var input in form_data) {
var element = $("#deadpan_" + form_data[input]['name']);
var valid = element.hasClass("valid");
// console.log(element);
// console.log(valid);
var error_element = $("span", element.parent());
if (!valid) {//invalid
error_element.removeClass("error").addClass("error_show");
element.addClass("error");
error_free = false;
} else {//valid
error_element.removeClass("error_show").addClass("error");
element.removeClass("error");
}
}
if (!error_free) {
event.preventDefault();
} else {
$deadpan_email = $('#deadpan_email').val();
$.cookie("DEADPAN_EMAIL", $deadpan_email, {expires: 10, path: '/'});
}
});
});
function validFormDeadpan() {
$fullname = jQuery('#deadpan_form #deadpan_fullname').val();
$email = jQuery('#deadpan_form #deadpan_email').val();
}
</script>
<?php } ?>
</div>
</div>
</div>
<div class="main-video col-full">
<script src="https://www.youtube.com/iframe_api" type="text/javascript"></script>
<div id="video-player" class="video-player col-md-9">
<div id="player"></div>
<script>
var videoid = '<?php echo str_replace('https://www.youtube.com/watch?v=', '', get_post_meta($first_video_id, 'video_link', true)); ?>';
var width = '700';
var height = '380';
</script>
<?php
// if ($first_video_id > 0) {
// echo wp_oembed_get(get_post_meta($first_video_id, 'video_link', true), array('width' => 700, 'height' => 380));
// }
?>
</div>
<div class="list-video mobile col-full">
</div>
<div style="cursor: pointer;" id="buy-now" class="col-md-3">
<a href="/get-started">
<span class="link-spanner"></span>
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/try-the-drink.jpg' ?>" alt="" />
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/buynow.png' ?>" alt="" />
<a href="/get-started" class="button btnrow" >Buy now</a>
</a>
</div>
</div>
<div class="list-video col-full">
<?php
$type = 'deadpan_video';
$args = array(
'post_type' => $type,
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts' => 1,
'orderby' => 'ID',
'order' => 'ASC',);
$my_query = null;
$my_query = new WP_Query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<?php
$video_title = get_post_meta(get_the_ID(), 'video_title', true);
$video_link = get_post_meta(get_the_ID(), 'video_link', true);
if (fgc_get_value_param($video_link, 'v') != '') {
$video_id = fgc_get_value_param($video_link, 'v');
$video_thumb = '//img.youtube.com/vi/' . $video_id . '/hqdefault.jpg';
} else {
$video_thumb = 'assets/images/blank_thumb_video.jpg';
}
?>
<div class="thumb-video col-md-4 col-xs-12" data-url="<?php echo $video_id; ?>" >
<img src="<?php echo $video_thumb; ?>" class="col-md-6 col-xs-6" />
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/play-icon.png' ?>" class="play-icon" />
<img src="<?php echo get_site_url() . '/wp-content/themes/reize/assets/images/play-icon-hover.png' ?>" class="play-icon-hover" />
<span class="col-md-6 col-xs-6 the-title-video">
<p class="number-episode font12 roboto_condensed"><?php the_title(); ?></p>
<p class="video-title font-soboto-slab"><?php echo $video_title; ?></p>
</span>
<!--<input type="hidden" name="video_ajax_link" value="<?php //echo get_site_url() . '?ajaxVideo&video_id=' . get_the_ID(); ?>" />-->
</div>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
</div>
<?php
/**
* @hooked storefront_display_comments - 10
*/
do_action('storefront_page_after');
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>