• Hi all, I’ve been trying to create a portfolio with the isotope jquery plugin.

    I’ve got the loop to work and to filter based on this:

    $categories=get_categories('taxonomy=types');

    My question is how do I get the taxonomy=types tags to display as a class in my div wrapping my posts? I tried using this:

    <?php $categories=get_categories('taxonomy=types');
    		foreach($categories as $category) {
    			echo $category->name . ' ';
    		}
    	?>

    but that gets every single tag under the taxonomy types and thus the isotope filter doesn’t work any help or a point in the right direction would be greatly appreciated!

    Tahnks!

Viewing 1 replies (of 1 total)
  • Thread Starter atlanteavila

    (@atlanteavila)

    Here’s my entire code:

    <h2>Filter the Content</h2>
    <ul id="filters">
    	 <li><a href="#" data-filter="*">show all</a></li>
    	<?php $categories=get_categories('taxonomy=types');
    		foreach($categories as $category) {
    			//and format them for use as isotope filters
    			echo '<li><a href="#" data-filter=".' . $category->slug . '" ' . '>' . $category->name . '</a></li>';
    		}
    	?>
    </ul>
    
      <div id="container" class="featuresLoop clearfix">
    <?php $counter =0; ?>
    <?php $my_query = new WP_Query('post_type=templates&showposts=10'); while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <?php   ++$counter;
      if($counter == 5) {
        $postclass = 'fifth';
        $counter = 0;
      } else { $postclass = ''; }
      ?>
    <div class="element actinoid inner-transition featContent <?php echo $postclass; ?> <?php $categories=get_categories('&post=ID,&taxonomy=types'); foreach($categories as $category) { echo $category->slug . ' ';} ?>" data-symbol="Hg" data-category="transition">
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail();?>
    <div class="featContentBtm">
    	<?php the_title();?>
    
    </div></a>
    </div>
    <?php endwhile; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘custom taxonomy as class in wrapping div’ is closed to new replies.