Multi Select Isotope Portfolio

Industry

0 ){
foreach ( $terms as $term ){
echo’slug.'” id=”‘.$term->slug.'” />slug.'”>’.$term->name.”;
}
}
?>

Framework

0 ){
foreach ( $terms as $term ){
echo’slug.'” id=”‘.$term->slug.'” />slug.'”>’.$term->name.”;
}
}
?>

Design

0 ){
foreach ( $terms as $term ){
echo’slug.'” id=”‘.$term->slug.'” />slug.'”>’.$term->name.”;
}
}
?>

</div>

-1, ‘order’=> ‘DESC’, ‘post_type’ => ‘myportfolio’, ‘paged’ => $paged);
$postslist = get_posts( $args );
//print_r($postslist);
//echo count($postslist);
foreach ($postslist as $post) :  setup_postdata($post);
$taxonomy = array(0=>’myportfolio_industry_cat’,1=>’myportfolio_framework_cat’,3=>’myportfolio_design_cat’);
$terms = get_the_terms( $post->ID, $taxonomy );

if ( $terms && ! is_wp_error( $terms ) ) :
$term_links = array();
$term_id = array();
foreach ( $terms as $term ) {
$term_links[] = $term->slug;
$term_id[] = $term->term_id;
}

$the_term = join( ” “, $term_links );
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
?>

<?php  endif;
wp_reset_query();
endforeach; ?>

</div><!–/#container–>
</div>
</div>

jQuery(function() {
jQuery(“#options”).buttonset();

var jQuerycontainer = jQuery(‘#containermultiiso’);
var jQueryfilterDisplay = jQuery(‘#filter-display’);

jQuerycontainer.isotope();

var jQuerymission_item = jQuery(‘

Mission

‘);
jQuery(‘#mission a’).toggle(function() {
jQuerycontainer
.prepend(jQuerymission_item).isotope( ‘reloadItems’ ).isotope({ sortBy: ‘original-order’});
}, function(){
jQuerycontainer
.isotope(‘remove’,jQuerymission_item);
});

var filters = {};

jQuery(‘#options’).on(‘change’, function(jQEvent) {

var checkbox = jQEvent.target;
var jQuerycheckbox = jQuery(checkbox);
var value = checkbox.value;
var isAll =jQuerycheckbox.hasClass(‘all’);

var group =jQuerycheckbox.parents(‘.option-set’).attr(‘data-group’);
// create array for filter group, if not there yet
if (!filters[group]) {
filters[group] = [];
}

var index =jQuery.inArray(checkbox.value, filters[group]);

if (isAll) {
delete filters[group];
if (!checkbox.checked) {
checkbox.checked = ‘checked’;
}
}

if (checkbox.checked) {
var selector = isAll ? ‘input’ : ‘input.all’;
jQuerycheckbox.siblings(selector).removeAttr(‘checked’);

if (!isAll && index === -1) {
// add filter to group
filters[group].push(checkbox.value);
}

} else if (!isAll) {
// remove filter from group
filters[group].splice(index, 1);
// if unchecked the last box, check the all
if (!jQuerycheckbox.siblings(‘[checked]’).length) {
jQuerycheckbox.siblings(‘input.all’).attr(‘checked’, ‘checked’);
}
}

var i = 0;
var comboFilters = [];
var message = [];

for (var prop in filters) {
message.push(filters[prop].join(‘ ‘));
var filterGroup = filters[prop];
// skip to next filter group if it doesn’t have any values
if (!filterGroup.length) {
continue;
}
if (i === 0) {
// copy to new array
comboFilters = filterGroup.slice(0);
} else {
var filterSelectors = [];
// copy to fresh array
var groupCombo = comboFilters.slice(0); // [ A, B ]
// merge filter Groups
for (var k = 0, len3 = filterGroup.length; k

Advertisements

Published by

oudarya

I am a developer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: