Skip to content

Instantly share code, notes, and snippets.

@wpexplorer
Created November 13, 2013 03:55
Show Gist options
  • Select an option

  • Save wpexplorer/7443453 to your computer and use it in GitHub Desktop.

Select an option

Save wpexplorer/7443453 to your computer and use it in GitHub Desktop.
Adapt archive-portfolio.php with filter
<?php
/**
* @package WordPress
* @subpackage Adapt Theme
*/
?>
<?php get_header(); ?>
<?php
// Load isotope scripts
wp_enqueue_script( 'isotope', WPEX_JS_DIR . '/isotope.js' );
wp_enqueue_script( 'isotope_init', WPEX_JS_DIR . '/isotope_init.js' ); ?>
<header id="page-heading" class="clearfix">
<h1><?php the_title(); ?></h1>
<?php $terms = get_terms( 'portfolio_category' ); ?>
<?php if( $terms[0] ) { ?>
<ul id="portfolio-cats" class="filter clearfix">
<li><a href="#" class="active" data-filter="*"><span><?php _e('All', 'wpex'); ?></span></a></li>
<?php foreach ($terms as $term ) : ?>
<li><a href="#" data-filter=".<?php echo $term->slug; ?>"><span><?php echo $term->name; ?></span></a></li>
<?php endforeach; ?>
</ul><!-- /portfolio-cats -->
<?php } ?>
</header><!-- /page-heading -->
<?php if ( have_posts() ) : ?>
<div id="portfolio-wrap" class="clearfix filterable-portfolio">
<div class="portfolio-content">
<?php while( have_posts() ) : the_post() ?>
<?php get_template_part( 'content', 'portfolio') ?>
<?php endwhile; ?>
<?php wpex_pagination(); ?>
</div><!-- /portfolio-content -->
</div><!-- /portfolio-wrap -->
<?php endif; ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment