data-filter issue
-
Hi
On the page: https://hogsozzle.com/artists/
the data-filters don’t work.
Error:
Uncaught TypeError: Object [object Object] has no method ‘isotope’This page is an exact copy of the “previous artists” page however, the queries are limited to display only items tagged with the category of 2014 artists.
Why would this break the data-filters?
Full code from template file is below.
<?php /* Template Name: Portfolio -Current Artists */ ?> <?php get_header(); ?> <div class="row"> <section class="portfolio-container twelve columns"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post-content"> <?php if ( is_search() ) { the_excerpt(); } else { the_content('<span>Continue Reading →</span>'); } ?> <?php if ( is_single()) { wp_link_pages(); } ?> </div> <?php endwhile; else : endif; ?> <div class="row"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $cols = get_post_meta($post->ID, 'portfolio_columns', TRUE); ?> <?php $catorg = get_post_meta($post->ID, 'portfolio_categories', TRUE); ?> <?php $cat = implode(',', $catorg); ?> <div class="twelve columns"> <h4><?php _e( 'Filter', THB_THEME_NAME ); ?></h4> <ul class="filters hide-for-small"> <li><a href="#" data-filter="*" class="active"><?php _e( 'show all', THB_THEME_NAME ); ?></a></li> <?php $portfolio_categories = get_categories(array('taxonomy'=>'project-category', 'include' => $cat)); foreach($portfolio_categories as $portfolio_category) { $args = array( 'post_type' => 'portfolio', 'posts_per_page' => '-1', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'project-category', 'field' => 'slug', 'terms' => $portfolio_category->slug ), array( 'taxonomy' => 'project-category', 'field' => 'id', 'terms' => 37 ) ) // end of tax_query ); $num = count(get_posts($args)); echo '<li><a href="#" data-filter=".' . $portfolio_category->slug . '">' . $portfolio_category->name . ' <span>('.$num.')</span></a></li>'; } ?> </ul> <div id="portfolioselect" class="show-for-small"> <a href="#" id="sortportfolio"><?php _e( 'Sort By:', THB_THEME_NAME ); ?></a> <ul> <li><a href="#" data-filter="*" class="active"><?php echo __('All', THB_THEME_NAME); ?></a></li> <?php $portfolio_categories = get_categories(array('taxonomy'=>'project-category', 'include' => $cat)); foreach($portfolio_categories as $portfolio_category) { $args = array( 'post_type' => 'portfolio', 'posts_per_page' => '-1', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'project-category', 'field' => 'slug', 'terms' => $portfolio_category->slug ), array( 'taxonomy' => 'project-category', 'field' => 'id', 'terms' => 37 ) ) // end of tax_query ); $num = count(get_posts($args)); echo '<li><a href="#" data-filter=".'.$portfolio_category->slug.'">' .$portfolio_category->name. ' <span>('.$num.')</span></a></li>'; } ?> </ul> </div> </div> <?php endwhile; else : endif; ?> </div> <?php if ($cols == 'three') { $columns = '4'; } else if ($cols == 'four') { $columns = '3'; } else if ($cols == 'six') { $columns = '2'; } ?> <div class="thbportfolio ajax row" data-columns="<?php echo $columns; ?>"> <?php $args = array( 'post_type' => 'portfolio', 'orderby'=>'menu_order', 'order' => 'ASC', 'posts_per_page' => '-1', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'project-category', 'field' => 'id', 'terms' => $catorg, 'operator' => 'IN' ), array( 'taxonomy' => 'project-category', 'field' => 'id', 'terms' => 37 ) ) // end of tax_query ); ?> <?php $query = new WP_Query($args); ?> <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); $terms = get_the_terms( get_the_ID(), 'project-category' ); $type = get_post_meta($post->ID, 'portfolio_type', true); $meta = str_replace("All 2011 Artists","",str_replace("All 2012 Artists","",str_replace("All 2013 Artists","",str_replace(",","",strip_tags( get_the_term_list( $post->ID, 'project-category', '', ', ', '' ) ))))); ?> <div class="item <?php echo $cols; ?> columns <?php foreach ($terms as $term) { echo strtolower($term->slug). ' '; } ?>"> <article id="post-<?php the_ID(); ?>" class="post cf"> <?php if (ot_get_option('disablelike') == 'no') { ?> <div class="imagelike"><?php echo thb_printLikes(get_the_ID()); ?></div> <?php } ?> <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?> <div class="post-gallery fresco"> <?php if ($cols == 'three') { ?> <?php the_post_thumbnail('onefourth'); ?> <?php } else if ($cols == 'four') { ?> <?php the_post_thumbnail('onethirds'); ?> <?php } else if ($cols == 'six') { ?> <?php the_post_thumbnail('onehalf'); ?> <?php } ?> <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; if ($type == "video") { $embed = get_post_meta($post->ID, 'portfolio_video', TRUE); $video_url = parse_video($embed); } ?> <?php switch($type) { case "link": ?> <?php $link = get_post_meta($post->ID, 'portfolio_link', TRUE); ?> <div class="overlay"> <a href="<?php echo $link; ?>" class="details" target="blank"><i class="icon-link"></i></a> </div> <?php break; case "standard": ?> <div class="overlay"> <a href="<?php the_permalink() ?>" class="details"><i class="icon-forward"></i></a> </div> <?php break; case "image": ?> <?php break; case "gallery": ?> <div class="overlay"> <a href="<?php the_permalink() ?>" class="details"><i class="icon-forward"></i></a> </div> <?php break; case "video": ?> <div class="overlay"> <a href="<?php the_permalink() ?>" class="details left"><i class="icon-forward"></i></a> <a href="<?php echo $video_url; ?>" class="zoom right video" rel="magnific" title="<?php the_title(); ?>"><i class="icon-play"></i></a> </div> <?php break; }?> </div> <?php } ?> <div class="post-title cf"> <h3><?php if ($type != 'link' AND $type != 'image') { ?><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><?php } else { the_title(); } ?></h3> <div class="excerpts"><?php echo $meta; ?></div> </div> </article> </div> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> </div> </section> </div> <?php get_footer(); ?>
The topic ‘data-filter issue’ is closed to new replies.