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 5
/
loop-portfolio-relative.php
70 lines (54 loc) · 1.87 KB
/
loop-portfolio-relative.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
<?php
/**
* The template for displaying the portfolio loop.
*
* @package Harbor
* @link https://themebeans.com/themes/harbor
*/
// GENERATE TERMS FOR FILTER PORTFOLIO TEMPLATE
$terms = get_the_terms( $post->ID, 'portfolio_category' );
$term_list = null;
if ( is_array( $terms ) ) {
foreach ( $terms as $term ) {
$term_list .= $term->term_id;
$term_list .= ' '; }
}
// ALTERNATE GRID IMAGE
$grid_feat_img = get_post_meta( $post->ID, '_bean_grid_feat_img', true );
$external_url = get_post_meta( $post->ID, '_bean_portfolio_external_url', true );
?>
<?php if ( has_post_thumbnail() or $grid_feat_img ) { ?>
<article id="project-<?php the_ID(); ?>" class="project masonry-project <?php echo esc_html( $term_list ); ?>">
<?php if ( $external_url ) { ?>
<a title="<?php printf( __( 'Permanent Link to %s', 'harbor' ), get_the_title() ); ?>" href="<?php echo esc_url( $external_url ); ?>" target="_blank" class="entry-link">
<?php } else { ?>
<a title="<?php printf( __( 'Permanent Link to %s', 'harbor' ), get_the_title() ); ?>" href="<?php the_permalink(); ?>" class="entry-link">
<?php } ?>
<?php
if ( $grid_feat_img ) {
echo '<img src="' . $grid_feat_img . '" height="375" width="500"/>';
} else {
the_post_thumbnail( 'grid-feat' );
}
?>
<div class="overlay"></div>
<div class="center-vertical">
<div class="overlay-title">
<h3><span><?php the_title(); ?></span></h3>
<?php
if ( get_theme_mod( 'loop_categories' ) == true ) {
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
echo '<ul class="project-taxonomy">';
foreach ( $terms as $term ) {
echo '<li><h5>#' . $term->name . '</h5></li>';
}
echo '</ul>';
}
}
?>
</div>
</div>
</a>
</article>
<?php
} //END if ( has_post_thumbnail )