I'm building a Site with Wordpress link to site It's a Site with Custom Post Types (product) and Custom Post Taxonomies (product_category).
On the Category page I have to filter the products by Subcategories. I found the filterable.js with a tutorial.
My Problem: If I click on any subcategory (Filter-Item) the browser (Chrome and Filezilla) doesn't work anymore.
If I click on the filter the browser says "processing request" after a long loading time the browser gives me an error. Here's a screenshot of the Browser error: http://farbstrakt.com/screenshot.png
I think the problem is about how I change the URL. I'm searching days for any solution but nothing. I can't find the error
here's my taxonomy-product_category.php
<div class="container middler" id="demo">
<ul class="filter-wrapper clearfix" id="portfolio-filter">
<?php
$args = array(
'show_count' => false,
'child_of' => get_queried_object()->term_id,
'taxonomy' => 'product_category',
'title_li' =>'',
);
$terms = get_categories($args);
$count = count($terms);
if ( $count > 0 ){
echo '<li class="cl-effect-2"><div><a href="#all" title=""><span data-hover="Alle">Alle</span></a></div></li>';
foreach ( $terms as $term ) {
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<li class="cl-effect-2">
<div>
<a href="#'.$termname.'">
<span data-hover="'.$term->name.'">'.$term->name.'</span>
</a>
</div>
</li>';
}
}
?>
</ul>
<?php
$loop = new WP_Query(array('post_type' => 'product', 'posts_per_page' => -1));
$count =0;
?>
<div id="portfolio-wrapper">
<ul class="grid effect-2 item-wrapper clearfix filter-all" id="grid">
<?php if ( $loop ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
$terms = get_the_terms( $post->ID, 'product_category' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
else :
$tax = '';
endif;
?>
<?php $infos = get_post_custom_values('_url'); ?>
<li class="<?php echo strtolower($tax); ?> all ">
<div>
<figure>
<a href="<?php the_permalink() ?>" class="img-link"><?php the_post_thumbnail( array(400, 160) ); ?></a>
<figcaption><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></figcpation>
</figure>
</div>
</li>
<?php endwhile; else: ?>
<p class="no-products">NO products
</p>
</ul>
<?php endif; ?>
and thats the short snippet from the code above where i think there must be the error.
<?php
$terms = get_the_terms( $post->ID, 'product_category' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
else :
$tax = '';
endif;
?>
<?php $infos = get_post_custom_values('_url'); ?>
<li class="<?php echo strtolower($tax); ?> all ">
Would be grateful if you could help me. I have searched a lot and didn't found any solution. I'm a PHP-Newbie. Of course I could use another filter plugin but I want to figure out where's the problem Thanks
#
$termname is not focusing on the correct element?, you need to make sure the element has the correct ID assigned - David