-
Notifications
You must be signed in to change notification settings - Fork 0
/
portfolio-page.php
95 lines (84 loc) · 3.68 KB
/
portfolio-page.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 Page
* Description: A Portfolio Template for portfolio page.
*/
?>
<?php get_header(); ?>
<main id="main" class="portfolio pure-g">
<h1 class="portfolio-title pd40"><?php the_title(); ?>
<?php $pp_breadcrumbs = ot_get_option('pp_breadcrumbs');
if ($pp_breadcrumbs === "on") {
?>
<span class="breadcrumb"><?php MyBreadcrumb(); ?></span>
<?php } ?>
</h1>
<section id="portfolio" class="pure-g">
<div id="filters" class="button-group js-radio-button-group fs pure-g portfolio-links">
<button id="show-all" class="button is-checked bttn active" data-filter="*">SHOW ALL</button>
<?php
$the_query = new WP_Query( array(
'post_type' => 'theportfolio',
'posts_per_page' => -1,
'_groupby' => 'ID',
'nopaging' => true,
) );
$itemsTag = array();
$itemsName = array();
while ($the_query->have_posts()): $the_query->the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$tag2 = $tag->name;
$tag = $tag->name;
$itemsTag[] = strtolower($tag);
$itemsName[] = $tag2;
}
}
endwhile;
for($i=0; $i<sizeof($itemsTag); $i++) {
$resultTag = array_unique($itemsTag);
$resultName = array_unique($itemsName);
echo "<button class='button bttn ".$resultName[$i]."hide' data-filter='.".$resultTag[$i]."-tag'>".$resultTag[$i]."</button>";
}
wp_reset_postdata();
?>
</div>
<div class="gallery pure-g">
<?php
$pp_portfolio_number = ot_get_option('pp_portfolio_number');
$query = new WP_Query(array(
'post_type' => 'theportfolio',
'posts_per_page' => $pp_portfolio_number,
'paged' => $paged
));
while ($query->have_posts()): $query->the_post();
?>
<figure class="effect-hera inside pure-u-lg-1-3 element-item <?php $posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$tag = $tag->name . '-tag ';
echo strtolower($tag);
}
} ?>">
<figcaption class="center-parent gallery-layer">
<p>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><span class="link-desc"><?php the_title(); ?></span><i class="icon icon-search"></i></a>
<a href="<?php echo get_post_meta($post->ID, "_location", true); ?>" title="<?php the_title(); ?>" target="blank"><span class="link-desc"><?php the_title(); ?></span><i class="icon icon-link"></i></a>
<span><?php the_title(); ?></span>
</p>
</figcaption>
<div class="faux-image" style='background-image:url(<?php
$url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
echo $url[0];
?>);'></div>
</figure>
<?php endwhile; ?>
<div class="next-prev-portfolio">
<?php next_posts_link( '', $query->max_num_pages ); ?>
<?php previous_posts_link( '' ); ?>
</div>
</div>
</section>
</main>
<?php get_footer(); ?>