Skip to content

Instantly share code, notes, and snippets.

@jonbellah
Created May 15, 2013 18:54
Show Gist options
  • Save jonbellah/5586354 to your computer and use it in GitHub Desktop.
Save jonbellah/5586354 to your computer and use it in GitHub Desktop.
Integrating isotope with custom post types - the HTML
<!-- Begin filter links -->
<div class="portfolio-filters">
<ul id="filters">
<li><a href="#" data-filter="*">All</a></li>
<!-- Begin filter loop -->
<?php
// Create an array and assign the projects taxonomy to it
$args = array( 'taxonomy' => 'skills' );
// Call the categories from this array
$categories=get_categories($args);
// Now, loop through them and...
foreach ($categories as $category) {
echo '<li><a href="#" data-filter=".'.$category->category_nicename.'">'.$category->cat_name;
echo '</a></li>';
} ?>
<!-- End filter loop -->
</ul>
</div>
<!-- End filter links -->
<!-- Begin portfolio loop -->
<section class="portfolio">
<div id="container">
<?php
// The Query
$the_query = new WP_Query( 'post_type=portfolio&posts_per_page=-1');
// The Loop
while ( $the_query->have_posts() ) :
$the_query->the_post(); ?>
<article class="<?php echo custom_taxonomies_terms_links(); ?>">
<!-- Your Portfolio Loop Content -- Example Below -->
<?php if ( has_post_thumbnail() ) { the_post_thumbnail() } ?>
<?php the_title(); ?>
</article>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</div>
</section>
<!-- End portfolio loop -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment