-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-portfolio.php
95 lines (70 loc) · 2.59 KB
/
template-portfolio.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
88
89
90
91
92
93
94
95
<?php
/**
* Template Name: Portfolio
*
*/
get_header(); ?>
<div class="row">
<div id="primary" class="col-md-12 col-lg-12">
<main id="main" class="site-main portfolio" role="main">
<?php
$terms = get_terms("portfolio_tags");
$count = count($terms);
echo '<div id="filters" class="btn-group btn-group-'.$filter_btn_size.'">';
echo '<button type="button" class="btn btn-danger'.$filter_btn_color.'" data-filter="*">'. __('All', 'bootville') .'</button>';
if ( $count > 0 )
{
foreach ( $terms as $term ) {
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<button type="button" class="btn btn-primary'.$filter_btn_color.'" data-filter=".'.$termname.'">'.$term->name.'</button>';
}
}
echo "</div>";
// }
?>
<?php
$pcount = 4; // Columns -1
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'posts_per_page' => -1,
'post_type' => 'portfolio',
'paged' => $paged,
);
$the_query = new WP_Query( $args );
?>
<div class="row">
<div id="portfolio-items">
<!-- the loop -->
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
$terms = get_the_terms( $post->ID, 'portfolio_tags' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
else :
$tax = '';
endif;
?>
<div class="col-sm-6 col-md-<?php echo $pcount; ?> item <?php echo strtolower($tax); ?>">
<div class="portfolio-item">
<a class="thumbnail" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
<div class="portfolio-button btn btn-primary btn-block"><?php the_title() ;?></div>
</a>
</div>
</div>
<?php endwhile; ?>
<!-- end of the loop -->
</div> <!-- #portfolio-items -->
</div> <!-- .row -->
<?php wp_reset_postdata(); ?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .row -->
<?php get_footer(); ?>