-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsingle.php
More file actions
executable file
·75 lines (43 loc) · 1.28 KB
/
Copy pathsingle.php
File metadata and controls
executable file
·75 lines (43 loc) · 1.28 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
<?php
$type = get_post_type( );
if($type === "post"){
get_header();
}else{
// CHECK FOR WOO ASSOCIATION::
if ( class_exists( 'WooCommerce' ) ) {
$productId = get_post_meta( get_the_ID(), 'streamium_premium_meta_box_woo_product', true );
if(!empty($productId)){
$current_user = wp_get_current_user();
if(!wc_customer_bought_product($current_user->user_email,$current_user->ID, $productId)){
$url = get_permalink( $productId );
wp_redirect( $url );
exit;
}
}
}
get_template_part( 'header', 'video' );
}
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
if($type === "post"){
get_template_part( 'templates/content', 'blog' );
}
if (in_array($type, streamium_global_meta())) {
get_template_part( 'templates/content', 'single' );
}
if (is_user_logged_in()) :
update_post_meta($post->ID,'recently_watched',current_time('mysql'));
update_post_meta($post->ID,'recently_watched_user_id',get_current_user_id());
endif;
?>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.', 'streamium' ); ?></p>
<?php endif; ?>
<?php
if($type === "post"){
get_footer();
}else{
get_template_part( 'footer', 'video' );
}
?>