Advertisement
dalbeck

All Works Template

Sep 26th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.62 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.             <aside id="work_nav">
  55.  
  56.                 <?php
  57.                  $terms = get_terms("post_tag", array('exclude' => '110, 120, 118, 115, 117, 119, 116, 132'));
  58.                  $count = count($terms);
  59.                  if ( $count > 0 ){
  60.                      echo "<ul class='work_tags_nav img_tags'>";
  61.                      foreach ( $terms as $term ) {
  62.                          $sanitizeTerm =  sanitize_title($term->name);
  63.                          $term_link = get_terms('name', $term->name, 'post_tag');
  64.                          $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
  65.                        echo '<li><a class="'. $term_class .'">' . $term->name . '.</a></li>';
  66.                      }
  67.                      echo '<li><a class="case_study">case studies.</a></li>';
  68.                      echo "</ul>";
  69.                  }
  70.                 ?>
  71.  
  72.                 <ul class="filter_nav work_tags_nav">
  73.                     <li class="active"><a class="all">all.</a></li>
  74.                     <?php
  75.                         query_posts(array( 'post_type'=> 'work', 'taxonomy' => 'type', 'posts_per_page' => -1 ));
  76.                         if ( have_posts() ) : while ( have_posts() ) : the_post();
  77.                         $exclude_these_term_ids = array(129, 133, 126, 127, 110, 131, 123, 124, 125);
  78.                             $custom_post_tags = get_the_tags();
  79.                         if ( $custom_post_tags ) {
  80.                             foreach( $custom_post_tags as $tag ) {
  81.                                 $tags_arr[] = $tag -> name;
  82.                             }
  83.                         }
  84.                         endwhile; endif;
  85.                         if( $tags_arr ) {
  86.                             $uniq_tags_arr = array_unique( $tags_arr );
  87.                          foreach( $uniq_tags_arr as $tag ) {
  88.                              // LIST ALL THE TAGS FOR DESIRED POST TYPE
  89.                              $sanitizeTag =  sanitize_title($tag);
  90.                              $tag_link = get_terms('name', $tag, 'post_tag');
  91.                              $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
  92.                              //echo '<li><a class="'.$tag.'" href="'. get_tag_link($tag_link->term_id).'">' .$tag. '.</a></li>';
  93.                              echo '<li><a class="'.$tag_class.'">' .$tag. '.</a></li>';
  94.                              }
  95.                          }
  96.                      ?>
  97.  
  98.                 </ul>
  99.  
  100.             </aside><!-- /#work_nav-->
  101.  
  102.             <?php wp_reset_query(); ?>
  103.  
  104.             <?php if ( is_page(99) ) { ?>
  105.  
  106.                 <!-- Show all case studies and portfolio items -->
  107.  
  108.                 <?php get_template_part( 'work', 'all' ); ?>
  109.  
  110.             <?php } else { ?>
  111.  
  112.             <?php if ( is_page(819) ) { ?>
  113.  
  114.                 <!-- Show all logos -->
  115.  
  116.                 <?php get_template_part( 'work', 'logos' ); ?>
  117.  
  118.             <?php } else { ?>
  119.  
  120.             <?php if ( is_page(1052) ) { ?>
  121.  
  122.                 <!-- Show all print work -->
  123.  
  124.                 <?php get_template_part( 'work', 'print' ); ?>
  125.  
  126.             <?php } else { ?>
  127.  
  128.             <?php if ( is_page(1057) ) { ?>
  129.  
  130.                 <!-- Show all vehicle work -->
  131.  
  132.                 <?php get_template_part( 'work', 'vehicle' ); ?>
  133.  
  134.             <?php } else { ?>
  135.  
  136.             <?php if ( is_page(1060) ) { ?>
  137.  
  138.                 <!-- Show all digital interactive work -->
  139.  
  140.                 <?php get_template_part( 'work', 'digital' ); ?>
  141.  
  142.             <?php } else { ?>
  143.  
  144.             <?php if ( is_page(1063) ) { ?>
  145.  
  146.                 <!-- Show all stationery work -->
  147.  
  148.                 <?php get_template_part( 'work', 'stationery' ); ?>
  149.  
  150.             <?php } else { ?>
  151.  
  152.             <?php if ( is_page(1066) ) { ?>
  153.  
  154.                 <!-- Show all outdoor/pop work -->
  155.  
  156.                 <?php get_template_part( 'work', 'outdoor' ); ?>
  157.  
  158.             <?php } else { ?>
  159.  
  160.             <?php if ( is_page(1073) ) { ?>
  161.  
  162.                 <!-- Show all non-profit work -->
  163.  
  164.                 <?php get_template_part( 'work', 'nonprofit' ); ?>
  165.  
  166.             <?php } else { ?>
  167.  
  168.             <?php if ( is_page(1080) ) { ?>
  169.  
  170.                 <!-- Show all apparel work -->
  171.  
  172.                 <?php get_template_part( 'work', 'apparel' ); ?>
  173.  
  174.             <?php } else { ?>
  175.  
  176.             <?php if ( is_page(1083) ) { ?>
  177.  
  178.                 <!-- Show all branding identity work -->
  179.  
  180.                 <?php get_template_part( 'work', 'branding' ); ?>
  181.  
  182.             <?php } } } } } } } } } } ?>
  183.  
  184.         </article>
  185.  
  186.     </article><!-- /#content-->
  187.  
  188. </section><!-- /#container-->
  189.  
  190. <?php get_template_part( 'sidebar', 'pagenav' ); ?>
  191.  
  192. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement