Advertisement
dalbeck

Untitled

Sep 28th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.40 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Work Page
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <section id="heading">
  9.  
  10.     <article>
  11.  
  12.         <?php the_title('<h2>', '</h2>'); ?>
  13.  
  14.         <ul>
  15.             <li><?php if(function_exists('bcn_display')) { bcn_display(); } ?></li>
  16.         </ul>
  17.  
  18.     </article>
  19.  
  20. </section><!-- /#heading-->
  21.  
  22. <section id="container">
  23.  
  24.     <article id="content">
  25.  
  26.         <?php if (has_post_thumbnail()) { ?>
  27.  
  28.             <aside id="banner">
  29.  
  30.                 <?php echo get_the_post_thumbnail($post_id, 'Featured', array(1200,320)); ?>
  31.  
  32.             </aside><!-- /#banner-->
  33.  
  34.         <?php } else { ?>
  35.  
  36.             <!-- Do Nothing -->
  37.  
  38.         <?php } ?>
  39.  
  40.         <article>
  41.  
  42.             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  43.  
  44.             <?php the_content(); ?>
  45.  
  46.             <?php endwhile; ?>
  47.  
  48.             <?php else : ?>
  49.  
  50.                 <h2>Sorry Nothing Found</h2>
  51.  
  52.             <?php endif; ?>
  53.            
  54.             <script>
  55.                 // Work Page - Smooth Filtering
  56.                 jQuery(document).ready(function(){
  57.                   var $container = jQuery('.work_items');
  58.                
  59.                   $container.isotope({
  60.                     itemSelector : '.work_item',
  61.                     animationOptions: {
  62.                      duration: 750,
  63.                      easing: 'swing',
  64.                      queue: false
  65.                    }
  66.                   });
  67.                  
  68.                   var $optionSets = jQuery('#work_nav .work_tags_nav'),
  69.                       $optionLinks = $optionSets.find('a');
  70.                
  71.                   $optionLinks.click(function(){
  72.                     var $this = jQuery(this);
  73.                     // don't proceed if already selected
  74.                     if ( $this.hasClass('selected') ) {
  75.                       return false;
  76.                     }
  77.                     var $optionSet = $this.parents('.work_tags_nav');
  78.                     $optionSet.find('.selected').removeClass('selected');
  79.                     $this.addClass('selected');
  80.                
  81.                     // make option object dynamically, i.e. { filter: '.my-filter-class' }
  82.                     var options = {},
  83.                         key = $optionSet.attr('data-option-key'),
  84.                         value = $this.attr('data-option-value');
  85.                     // parse 'false' as false boolean
  86.                     value = value === 'false' ? false : value;
  87.                     options[ key ] = value;
  88.                     if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
  89.                       // changes in layout modes need extra logic
  90.                       changeLayoutMode( $this, options )
  91.                     } else {
  92.                       // otherwise, apply new options
  93.                       $container.isotope( options );
  94.                     }
  95.                     return false;
  96.                     });
  97.                    
  98.    
  99.                    
  100.                 });
  101.            
  102.             </script>
  103.  
  104.             <aside id="work_nav">
  105.  
  106.                 <?php
  107.                  $terms = get_terms("post_tag", array('exclude' => '110, 120, 118, 115, 117, 119, 116, 132'));
  108.                  $count = count($terms);
  109.                  if ( $count > 0 ){
  110.                      echo "<ul class='work_tags_nav img_tags'>";
  111.                      foreach ( $terms as $term ) {
  112.                          $sanitizeTerm =  sanitize_title($term->name);
  113.                          $term_link = get_terms('name', $term->name, 'post_tag');
  114.                          $term_class = preg_replace('/[^A-Za-z0-9-]+/', '_', html_entity_decode($term->name)); // This strips our sepcial characers and spaces, then replaces them with an underscore
  115.                          echo '<li><a class="'. $term_class .'">' . $term->name . '.</a></li>';
  116.                      }
  117.                      echo '<li><a href="#filter" data-option-value=".case_study">case studies.</a></li>';
  118.                      echo "</ul>";
  119.                  }
  120.                 ?>
  121.  
  122.                 <ul class="filter_nav work_tags_nav" data-option-key="filter">
  123.                     <li><a href="#filter" data-option-value="*" class="all selected">all.</a></li>
  124.                     <?php
  125.                         query_posts(array( 'post_type'=> 'work', 'taxonomy' => 'type', 'posts_per_page' => -1 ));
  126.                         if ( have_posts() ) : while ( have_posts() ) : the_post();
  127.                         $exclude_these_term_ids = array(129, 133, 126, 127, 110, 131, 123, 124, 125);
  128.                             $custom_post_tags = get_the_tags();
  129.                         if ( $custom_post_tags ) {
  130.                             foreach( $custom_post_tags as $tag ) {
  131.                                 $tags_arr[] = $tag -> name;
  132.                             }
  133.                         }
  134.                         endwhile; endif;
  135.                         if( $tags_arr ) {
  136.                             $uniq_tags_arr = array_unique( $tags_arr );
  137.                          foreach( $uniq_tags_arr as $tag ) {
  138.                              // LIST ALL THE TAGS FOR DESIRED POST TYPE
  139.                              $sanitizeTag =  sanitize_title($tag);
  140.                              $tag_link = get_terms('name', $tag, 'post_tag');
  141.                              $tag_class = preg_replace('/[^A-Za-z0-9-]+/', '_', html_entity_decode($tag)); // This strips our sepcial characers and spaces, then replaces them with an underscore
  142.                              //echo '<li><a class="'.$tag.'" href="'. get_tag_link($tag_link->term_id).'">' .$tag. '.</a></li>';
  143.                              echo '<li><a href="#filter" data-option-value=".' . $tag_class . '">' .$tag. '.</a></li>';
  144.                              }
  145.                          }
  146.                      ?>
  147.  
  148.                 </ul>
  149.  
  150.             </aside><!-- /#work_nav-->
  151.  
  152.             <?php wp_reset_query(); ?>
  153.  
  154.             <article class="work_items">
  155.  
  156.                 <?php if ( is_page(99) ) { ?>
  157.  
  158.                     <!-- Show all case studies and portfolio items -->
  159.  
  160.                     <?php get_template_part( 'work', 'all' ); ?>
  161.  
  162.                 <?php } else { ?>
  163.  
  164.                 <?php if ( is_page(819) ) { ?>
  165.  
  166.                     <!-- Show all logos -->
  167.  
  168.                     <?php get_template_part( 'work', 'logos' ); ?>
  169.  
  170.                 <?php } else { ?>
  171.  
  172.                 <?php if ( is_page(1052) ) { ?>
  173.  
  174.                     <!-- Show all print work -->
  175.  
  176.                     <?php get_template_part( 'work', 'print' ); ?>
  177.  
  178.                 <?php } else { ?>
  179.  
  180.                 <?php if ( is_page(1057) ) { ?>
  181.  
  182.                     <!-- Show all vehicle work -->
  183.  
  184.                     <?php get_template_part( 'work', 'vehicle' ); ?>
  185.  
  186.                 <?php } else { ?>
  187.  
  188.                 <?php if ( is_page(1060) ) { ?>
  189.  
  190.                     <!-- Show all digital interactive work -->
  191.  
  192.                     <?php get_template_part( 'work', 'digital' ); ?>
  193.  
  194.                 <?php } else { ?>
  195.  
  196.                 <?php if ( is_page(1063) ) { ?>
  197.  
  198.                     <!-- Show all stationery work -->
  199.  
  200.                     <?php get_template_part( 'work', 'stationery' ); ?>
  201.  
  202.                 <?php } else { ?>
  203.  
  204.                 <?php if ( is_page(1066) ) { ?>
  205.  
  206.                     <!-- Show all outdoor/pop work -->
  207.  
  208.                     <?php get_template_part( 'work', 'outdoor' ); ?>
  209.  
  210.                 <?php } else { ?>
  211.  
  212.                 <?php if ( is_page(1073) ) { ?>
  213.  
  214.                     <!-- Show all non-profit work -->
  215.  
  216.                     <?php get_template_part( 'work', 'nonprofit' ); ?>
  217.  
  218.                 <?php } else { ?>
  219.  
  220.                 <?php if ( is_page(1080) ) { ?>
  221.  
  222.                     <!-- Show all apparel work -->
  223.  
  224.                     <?php get_template_part( 'work', 'apparel' ); ?>
  225.  
  226.                 <?php } else { ?>
  227.  
  228.                 <?php if ( is_page(1083) ) { ?>
  229.  
  230.                     <!-- Show all branding identity work -->
  231.  
  232.                     <?php get_template_part( 'work', 'branding' ); ?>
  233.  
  234.                 <?php } } } } } } } } } } ?>
  235.  
  236.             </article><!-- /.work_itmes-->
  237.  
  238.         </article>
  239.  
  240.     </article><!-- /#content-->
  241.  
  242. </section><!-- /#container-->
  243.  
  244. <?php get_template_part( 'sidebar', 'pagenav' ); ?>
  245.  
  246. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement