Advertisement
srikat

archive-portfolio.php

Dec 6th, 2013
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.14 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The custom portfolio post type archive template for a Filterable Portfolio
  4.  */
  5.  
  6. # Force full width content
  7. add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  8.  
  9. wp_enqueue_script('isotope', get_stylesheet_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), '1.5.25', true);
  10. wp_enqueue_script('isotope_init', get_stylesheet_directory_uri() . '/js/isotope_init.js', array('isotope'), '', true);
  11.  
  12. //* Add custom body class
  13. add_filter( 'body_class', 'filerable_portfolio_add_body_class' );
  14.  
  15. //* Filterable Portfolio custom body class
  16. function filerable_portfolio_add_body_class( $classes ) {
  17.     $classes[] = 'filterable-portfolio-page';
  18.         return $classes;
  19. }
  20.  
  21. remove_action( 'genesis_loop', 'genesis_do_loop' );
  22. add_action( 'genesis_loop', 'filterable_portfolio_do_loop' );
  23.  
  24. /**
  25.  * Outputs a custom loop
  26.  *
  27.  * @global mixed $paged current page number if paginated
  28.  * @return void
  29.  */
  30. function filterable_portfolio_do_loop() { ?>
  31.  
  32.     <header id="page-heading" class="entry-header">
  33.         <?php $terms = get_terms( 'portfolio-category' ); ?>
  34.         <?php if( $terms[0] ) { ?>
  35.             <ul id="portfolio-cats" class="filter clearfix">
  36.                 <li><a href="#" class="active" data-filter="*"><span><?php _e('All', 'genesis'); ?></span></a></li>
  37.                 <?php foreach ($terms as $term ) : ?>
  38.                     <li><a href="#" data-filter=".<?php echo $term->slug; ?>"><span><?php echo $term->name; ?></span></a></li>
  39.                 <?php endforeach; ?>
  40.             </ul><!-- /portfolio-cats -->
  41.         <?php } ?>
  42.     </header><!-- /page-heading -->
  43.  
  44.     <div class="entry-content" itemprop="text">
  45.          <?php if( have_posts() ) { ?>
  46.             <div id="portfolio-wrap" class="clearfix filterable-portfolio">
  47.                 <div class="portfolio-content">
  48.                     <?php $wpex_count=0; ?>
  49.                     <?php global $query_string;
  50.                     query_posts( $query_string . '&posts_per_page=-1' ); ?>
  51.                     <?php while( have_posts() ) : the_post() ?>
  52.                         <?php $wpex_count++; ?>
  53.                         <?php $terms = get_the_terms( get_the_ID(), 'portfolio-category' ); ?>
  54.                         <?php if ( has_post_thumbnail($post->ID) ) { ?>
  55.                             <article class="portfolio-item col-<?php echo $wpex_count; ?> <?php if( $terms ) foreach ( $terms as $term ) { echo $term->slug .' '; }; ?>">
  56.                                 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo genesis_get_image( array( size => 'portfolio' ) ); ?>
  57.                                 <div class="portfolio-overlay"><h3><?php the_title(); ?></h3></div><!-- portfolio-overlay --></a>
  58.                             </article>
  59.                         <?php } ?>
  60.                     <?php endwhile; ?>
  61.                     <?php wp_reset_query() ?>
  62.                 </div><!-- /portfolio-content -->
  63.             </div><!-- /portfolio-wrap -->
  64.         <?php } ?>
  65.         <?php wp_reset_postdata(); ?>
  66.     </div><!-- /entry-content -->
  67.  
  68. <?php }
  69.  
  70. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement