This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
portfolio.php
56 lines (52 loc) · 1.95 KB
/
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
<?php
/*
* Template Name: Portfolio
* Description: A simple portfolio template that implements mixitup (mixitup.io)
* and Lightbox 2 by Lokesh Dhakar (lokeshdhakar.com/projects/lightbox2/).
*/
get_header(); ?>
<div class="controls">
<span id="filters">
<h3>Categories</h3>
<ul id="filters">
<li class="filter" data-filter="all">All</li>
<?php
$args = array('exclude' => '1');
$categories = get_categories($args);
foreach ($categories as $category) {
echo '<li class="filter" data-filter="' . $category->slug . '">' . $category->name . '</li>';
}
?>
</ul>
</span>
<span id="sorts">
<h3>Sort</h3>
<ul>
<li class="sort" data-sort="default" data-order="asc">Default</li>
<li class="sort" data-sort="random">Randomize</li>
</ul>
</span>
</div>
<?php while ( have_posts() ) : the_post(); ?>
<ul id="Grid">
<?php
$args = Array('post_type' => 'attachment', 'numberposts' => -1, 'post-mime-type' => 'image');
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
$post_id = $attachment->post_parent;
$post_cat = get_the_category($post_id);
$post_title = $attachment->post_title;
$cat_name = $post_cat[0]->cat_name;
$cat_slug = $post_cat[0]->slug;
echo '<li class="mix ' . $cat_slug . '">';
echo '<a href="' . wp_get_attachment_url($attachment->ID) . '">';
echo wp_get_attachment_image($attachment->ID, 'thumbnail');
echo '</a></li>';
}
}
?>
<li class="break"></li>
</ul>
<?php endwhile; ?>
<?php get_footer() ?>