This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-projects.php
101 lines (85 loc) · 2.55 KB
/
template-projects.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
96
97
98
99
100
101
<?php
/**
* Template Name: Projects
*/
get_header();
?>
<section class="section">
<div class="columns">
<?php
$projects = new WP_query([
'post_type' => 'project'
]);
if ($projects->have_posts()) {
while ($projects->have_posts()) {
$projects->the_post();
$project_meta = get_post_meta(get_the_ID(), 'sundown_project', true);
empty($project_meta['preview']) ? $icon = 'mdi-eye-off' : $icon = 'mdi-eye';
?>
<div class="column is-half-desktop is-one-quarter-widescreen">
<div class="card">
<div class="card-header">
<div class="card-header-title">
<h1 class="title is-size-4"><?php echo $project_meta['title'] ?></h1>
</div>
</div>
<?php
if (the_post_thumbnail()) {
?>
<div class="card-image">
<figure class="image is-4by3">
<img src="<?php echo get_the_post_thumbnail()['url']; ?>" alt="<?php echo get_the_post_thumbnail()['alt']; ?>">
</figure>
</div>
<?php
}
?>
<div class="card-content">
<p>
<?php
echo $project_meta['description'];
?>
</p>
</div>
<div class="card-footer">
<a href="<?php echo $project_meta['github']; ?>" title="<?php _e('Source code', 'sundown'); ?>" target="_blank">
<span class="icon is-large">
<i class="mdi mdi-24px mdi-github-circle"></i>
</span>
</a>
<?php
if (!empty($project_meta['preview'])) {
?>
<a href="<?php echo $project_meta['preview']; ?>" title="<?php _e('Preview', 'sundown'); ?>" target="_blank">
<?php
} else {
?>
<span>
<?php
}
?>
<span class="icon is-large">
<i class="mdi mdi-24px <?php echo $icon; ?>"></i>
</span>
<?php
if (!empty($project_meta['preview'])) {
?>
</a>
<?php
} else {
?>
</span>
<?php
}
?>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</section>
<?php
get_footer();