This repository has been archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
loop-download.php
87 lines (67 loc) · 2.41 KB
/
loop-download.php
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
<?php
/**
* The template for displaying the downloads loop.
*
* @package Trim
* @link https://themebeans.com/themes/trim
*/
// GENERATE TERMS FOR FILTER PORTFOLIO TEMPLATE
$terms = get_the_terms( $post->ID, 'download_category' );
$term_list = null;
if ( is_array( $terms ) ) {
foreach ( $terms as $term ) {
$term_list .= $term->term_id;
$term_list .= ' '; }
}
// GRID IMAGE
$download_grid_image = get_post_meta( $post->ID, '_bean_download_grid_image', true );
// IS THE PORTFOLIO META ENABLED?
if ( get_theme_mod( 'edd_meta', trim_defaults( 'edd_meta' ) ) == true ) {
$meta = '';
} else {
$meta = 'no-meta';
} ?>
<?php if ( has_post_thumbnail() || $download_grid_image ) { ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( "post $term_list $meta portfolio filtered" ); ?>>
<div class="post-thumb">
<a title="<?php echo the_title_attribute(); ?>" href="<?php the_permalink(); ?>">
<?php if ( $download_grid_image ) { ?>
<img src="<?php echo esc_url( $download_grid_image ); ?>" />
<?php } else { ?>
<?php the_post_thumbnail( 'post-feat' ); ?>
<?php } ?>
</a>
<div class="product-btn">
<?php echo do_shortcode( '[purchase_link]' ); ?>
</div>
</div>
<?php if ( get_theme_mod( 'edd_meta', trim_defaults( 'edd_meta' ) ) == true ) { ?>
<div class="inner">
<h3 class="entry-title">
<a title="<?php printf( __( 'Permanent Link to %s', 'trim' ), get_the_title() ); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h3>
<?php if ( ! post_password_required() ) { ?>
<p class="entry-excerpt">
<?php if ( ! is_search() ) { ?>
<?php echo wp_trim_words( get_the_content(), 13 ); ?>
<?php } else { ?>
<?php echo wp_trim_words( get_the_content(), 30 ); ?>
<?php } ?>
</p><!-- END .entry-excerpt -->
<?php } else { ?>
<?php echo get_the_content(); ?>
<?php } ?>
<ul class="entry-meta subtext">
<?php $terms = get_the_terms( $post->ID, 'download_category' ); ?>
<?php if ( $terms && ! is_wp_error( $terms ) ) : ?>
<li><?php the_terms( $post->ID, 'download_category', '', ', ', '' ); ?></li>
<?php endif; ?>
<?php if ( get_theme_mod( 'edd_likes', trim_defaults( 'edd_likes' ) ) == true ) { ?>
<li class="likes"><?php Bean_PrintLikes( $post->ID ); ?></li>
<?php } ?>
</ul><!-- END .entry-meta -->
</div><!-- END .inner -->
<?php } ?>
</article>
<?php
}