Hope someone here can help me. Ive been commissioned to convert a template to wordpress that includes a portfolio...
I built a portfolio page from a custom post type. that works.
Items are categorized with a custom taxonomy named port_cats. that works also
On the portfolio page, there is tabbed content built with jquery to show and hide items by category. So theres a category nav menu, plus each item wrapped in classes to show and hide.
Im stuck on plugging this in correctly, and am SO CLOSE. I have the category nav list working, but having trouble getting worpress to read the correct category slug inside the loop.
Heres how the jquery needs to work:
for the menu:
<li><a href="#" rel="category-slug">Category Name</a></li>
to hide and show the items:
<ul>
<li class="category-slug">
title/thumb/content
</li>
</ul>
Heres my code:
<ul class="select">
<?php
//list custom portfolio categories
$taxonomy = 'port_cats'; // define portfolio categories from taxonomies in functions.php
$tax_terms = get_terms($taxonomy);
foreach ($tax_terms as $tax_term) {
echo '<li><a href="#" rel="' . $tax_term->slug . '">' . $tax_term->name.'</a></li>';
}
?>
</ul>
<ul class="display">
<?php // ADD PORTFOLIO
$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 6));
while ( $loop->have_posts() ) : $loop->the_post();
$custom = get_post_custom($post->ID);
$screenshot_url = $custom["screenshot_url"][0];
$website_url = $custom["website_url"][0];
?>
<li class="<?php echo $tax_term->slug; ?> ">
<a href="<?=$website_url?>"><?php the_post_thumbnail(); ?></a>
<?php the_title(); ?>
<?php the_content(); ?>
<a href="<?=$website_url?>Learn more</a>
</li>
<?php endwhile; ?>
</ul>
Whats happening is that worpdress is repeating the last category slug on every display item...
can anyone tell me what i have wrong here???
THANK YOU!
Trisha