Beispiel #1
0
function rt_last_seen_question_url()
{
    $rt_obj = rt_get_rt_obj();
    if (!empty($rt_obj->videosPlayed)) {
        return get_permalink($rt_obj->videos[end($rt_obj->videosPlayed)]->question);
    } else {
        return get_permalink(reset($rt_obj->videos)->question);
    }
    return '';
}
					<div class="rt-button cancel">CANCEL</div>
				</div>
			</form>
			<div id="submit-later-success">
				<h4>Your perspective makes us better.</h4>
					<p>We have sent you an email so you can share later. Thanks!</p>
				<div class="submit-row">
					<div class="rt-button cancel">CLOSE</div>
				</div>
			</div>
		</div>
	</div>
	<div class="modal" id="viewed-all">
		<div class="overlay"></div>
		<div class="modal-content">
			<p>YOU HAVE VIEWED ALL THE VIDEOS, NOW IT'S YOUR TURN TO SHARE A STORY.</p>
			<div class="button-row">
				<a href="/upload/?q=<?php 
echo is_singular('question') ? get_the_ID() : rt_get_rt_obj()->videos[get_the_ID()]->question;
?>
" class="rt-button">SHARE STORY</a>
			</div>
			<div class="button-row">
				<a href="/community-gallery" class="rt-button">GO TO COMMUNITY GALLERY</a>
			</div>
		</div>
	</div>

</div>
<?php 
get_footer();
Beispiel #3
0
<?php

if (!is_admin()) {
    add_action('wp_enqueue_scripts', function () {
        $rt = rt_get_rt_obj();
        wp_localize_script('foundation', 'rt', (array) $rt);
    }, 100);
}
function rt_get_rt_obj()
{
    $rt = new stdClass();
    $rt->videos = array();
    $rt->questions = array();
    $rt->lastVideo = false;
    $rt->firstVideoID = null;
    $rt->nextVideo = null;
    $rt->videosPlayed = array();
    if (!empty($_COOKIE['videosPlayed'])) {
        $rt->videosPlayed = json_decode(stripslashes(urldecode($_COOKIE['videosPlayed'])));
    }
    $videos = get_posts(array('post_type' => 'video', 'posts_per_page' => -1, 'orderby' => 'menu_order'));
    $questions = get_posts(array('post_type' => 'question', 'posts_per_page' => -1));
    foreach ($videos as $i => $video) {
        if ($i == 0) {
            $rt->firstVideoID = $video->ID;
        }
        $rt->videos[$video->ID] = new stdClass();
        $rt->videos[$video->ID]->link = get_permalink($video);
        $connected_question = new WP_Query(array('connected_type' => 'video_to_question', 'connected_items' => $video->ID, 'connected_direction' => 'from'));
        if ($connected_question->have_posts()) {
            $rt->videos[$video->ID]->question = $connected_question->post->ID;