This repository was archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsingle-download.php
More file actions
125 lines (103 loc) · 3.92 KB
/
single-download.php
File metadata and controls
125 lines (103 loc) · 3.92 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
<?php
/**
* The Template for displaying all single downloads.
*
* @package Checkout
* @since Checkout 1.0
*/
/**
* Get the download ID to use below
*/
$download_id = get_the_ID();
get_header(); ?>
<div id="main" class="site-main">
<div class="sticky-container">
<div id="primary">
<div id="content" class="site-content container" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'partials/content-download' ); ?>
<!-- Get the next/previous post navs -->
<?php checkout_post_navs(); ?>
<!-- Get the EDD reviews -->
<?php if ( class_exists( 'EDD_Reviews' ) ) {
global $post;
$user = wp_get_current_user();
$user_id = ( isset( $user->ID ) ? (int) $user->ID : 0 );
if ( ! edd_reviews()->is_review_status( 'disabled' ) ) {
?>
<div class="comments-section reviews-section">
<div class="comments">
<div class="comments-wrap">
<?php
edd_get_template_part( 'reviews' );
if ( get_option( 'thread_comments' ) ) {
edd_get_template_part( 'reviews-reply' );
}
?>
</div><!-- .comments-wrap -->
</div><!-- #comments -->
</div><!-- .comments-section -->
<?php } }
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
<div id="secondary">
<div id="sticker">
<div id="purchase-box" class="purchase-box">
<?php do_action( 'checkout_above_purchase_sidebar' ); ?>
<div class="download-price download-aside">
<?php if ( edd_has_variable_prices( $download_id ) ) { ?>
<!-- Get the price range -->
<div class="purchase-price price-range">
<?php echo edd_price_range( $download_id ); ?>
</div>
<?php } else if ( function_exists( 'edd_cp_has_custom_pricing' ) && edd_cp_has_custom_pricing( $download_id ) ) { ?>
<div class="purchase-price name-price">
<?php _e( 'Name your price:', 'checkout' ); ?>
</div>
<?php } else if ( edd_is_free_download( $download_id ) ) { ?>
<div class="purchase-price">
<?php _e( 'Free', 'checkout' ); ?>
</div>
<?php } else { ?>
<!-- Get the single price -->
<div class="purchase-price">
<?php edd_price( $download_id ); ?>
</div>
<?php } ?>
<?php
// Get purchase button settings
$behavior = get_post_meta( $download_id, '_edd_button_behavior', true );
$hide_button = get_post_meta( $download_id, '_edd_hide_purchase_link', true ) ? 1 : 0;
// If it's a direct purchase show this text
if ( $behavior == 'direct' ) {
$button_text = __( 'Buy Now', 'checkout' );
} else {
// if it's an add to cart purchase, get the text from EDD options
$button_text = ! empty( $edd_options[ 'add_to_cart_text' ] ) ? $edd_options[ 'add_to_cart_text' ] : __( 'Purchase', 'checkout' );
}
?>
<?php
// Show the button unless set to not show
if ( ! $hide_button ) {
echo edd_get_purchase_link( array(
'download_id' => $download_id,
'price' => false,
'direct' => edd_get_download_button_behavior( $download_id ) == 'direct' ? true : false,
'text' => $button_text
) );
}
?>
<?php do_action( 'checkout_below_purchase_button' ); ?>
</div><!-- .download-price -->
<?php do_action( 'checkout_below_purchase_sidebar' ); ?>
</div><!-- .purchase-box -->
</div><!-- #sticker -->
</div><!-- #secondary -->
</div><!-- #main .site-main -->
</div><!-- .sticky-container -->
<?php get_footer(); ?>