-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathportfolio2.php
More file actions
160 lines (124 loc) · 4.46 KB
/
Copy pathportfolio2.php
File metadata and controls
160 lines (124 loc) · 4.46 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/*
Template Name: 2 Column Portfolio
*/
?>
<?php get_header();
?>
<div id="mainwrap">
<div id="main">
<?php $portfolio = get_post_custom($post->ID);
if(isset($portfolio['port_category'][0]))
$port= $portfolio['port_category'][0];
else
$port = 0;
?>
<?php if(!isset($portfolio['port_category'][0]) || ($portfolio['port_category'][0]==0)){ ?>
<div id="remove" class="portfolioremove">
<h2><a class="catlink" href="#filter=*" >Show All <span> </span></a>
<?php $categories = get_terms("portfoliocategory");
foreach ($categories as $category) {
$entrycategory = str_replace(' ', '-', $category->name);
echo '<a class="catlink" href="#filter=.'.$entrycategory .'" >'.$category->name.' <span class="aftersortingword"> </span></a>';
}
?>
</h2>
</div>
<?php } ?>
<div class="portfolio">
<div id="portitems2">
<?php
if($port != 0)
portfolio(375,375,2,'port','',getcatslug($port));
else
portfolio(375,375,2,'port','');
?>
</div>
</div>
</div>
</div>
<script>
jQuery(function(){
var $container = jQuery('#portitems2'),
// object that will keep track of options
isotopeOptions = {},
// defaults, used if not explicitly set in hash
defaultOptions = {
filter: '*',
sortBy: 'original-order',
sortAscending: true,
layoutMode: 'masonry'
};
// ensure no transforms used in Opera
if ( jQuery.browser.opera ) {
defaultOptions.transformsEnabled = false;
}
var setupOptions = jQuery.extend( {}, defaultOptions, {
itemSelector : '.item2',
});
// set up Isotope
$container.isotope( setupOptions );
var $optionSets = jQuery('#options').find('.option-set'),
isOptionLinkClicked = false;
// switches selected class on buttons
function changeSelectedLink( $elem ) {
// remove selected class on previous item
$elem.parents('.option-set').find('.selected').removeClass('selected');
// set selected class on new item
$elem.addClass('selected');
}
$optionSets.find('a').click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
return;
}
changeSelectedLink( $this );
// get href attr, remove leading #
var href = $this.attr('href').replace( /^#/, '' ),
// convert href into object
// i.e. 'filter=.inner-transition' -> { filter: '.inner-transition' }
option = $.deparam( href, true );
// apply new option to previous
jQuery.extend( isotopeOptions, option );
// set hash, triggers hashchange on window
jQuery.bbq.pushState( isotopeOptions );
isOptionLinkClicked = true;
return false;
});
var hashChanged = false;
jQuery(window).bind( 'hashchange', function( event ){
// get options object from hash
var hashOptions = window.location.hash ? jQuery.deparam.fragment( window.location.hash, true ) : {},
// do not animate first call
aniEngine = hashChanged ? 'best-available' : 'none',
// apply defaults where no option was specified
options = jQuery.extend( {}, defaultOptions, hashOptions, { animationEngine: aniEngine } );
// apply options from hash
$container.isotope( options );
// save options
isotopeOptions = hashOptions;
// if option link was not clicked
// then we'll need to update selected links
if ( !isOptionLinkClicked ) {
// iterate over options
var hrefObj, hrefValue, $selectedLink;
for ( var key in options ) {
hrefObj = {};
hrefObj[ key ] = options[ key ];
// convert object into parameter string
// i.e. { filter: '.inner-transition' } -> 'filter=.inner-transition'
hrefValue = jQuery.param( hrefObj );
// get matching link
$selectedLink = $optionSets.find('a[href="#' + hrefValue + '"]');
changeSelectedLink( $selectedLink );
}
}
isOptionLinkClicked = false;
hashChanged = true;
})
// trigger hashchange to capture any hash data on init
.trigger('hashchange');
});
</script>
<?php get_footer(); ?>