Advertisement
dalbeck

Untitled

Sep 28th, 2013
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.08 KB | None | 0 0
  1.  
  2.                 <?php
  3.                     $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
  4.                     $all_work = new WP_Query(array(
  5.                         'post_type' => 'work',
  6.                         'tax_query' => array(
  7.                             array(
  8.                                 'taxonomy' => 'type',
  9.                                 'field' => 'slug',
  10.                                 'terms' => array('case-study', 'portfolio')
  11.                             ),
  12.                         ),
  13.                         'posts_per_page' => '30',
  14.                         'orderby' => 'title',
  15.                         'order' => 'ASC',
  16.                         'update_post_term_cache' => false,
  17.                         'paged' => $paged
  18.                         )
  19.                     );
  20.                     while ( $all_work->have_posts() ) : $all_work->the_post();
  21.                 ?>
  22.  
  23.                     <aside class="work_item <?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>" data-id="id-<?php the_id(); ?>" data-category="<?php $posttags = get_the_terms($post->ID, 'type'); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ''); } } ?>">
  24.  
  25.                         <ul>
  26.                             <li>
  27.                                 <div class="img_wrap">
  28.                                     <?php echo get_the_post_thumbnail( $post->ID, 'Work Gallery', array('class' => 'lazy') ); ?>
  29.                                 </div><!-- /.img_wrap-->
  30.  
  31.                                 <ul class="work_meta">
  32.                                     <li class="work_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  33.  
  34.                                     <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { // show 25 characters from the content if the post is a case study ?>
  35.  
  36.                                          <li class="work_item_content"><?php the_excerpt(25); ?></li>
  37.  
  38.                                     <?php } else { ?>
  39.  
  40.                                     <?php if ( 'work' == get_post_type() && has_term( 'portfolio', 'type' ) ) { // if the post is a portfolio item show the DESCRIPTION of the image ?>
  41.  
  42.                                         <!--<li class="work_item_content"><?php echo get_post(get_post_thumbnail_id())->post_content; ?></li>-->
  43.                                         <li class="work_item_content"><?php echo gds_get_excerpt($image->ID); ?></li>
  44.  
  45.                                     <?php } } ?>
  46.  
  47.                                     <?php
  48.                                         if( has_tag() ) {
  49.                                             // IF THE POST HAS TAGS
  50.                                             the_tags('<li class="work_tags first">', '.</li><li class="work_tags">', '.</li>');
  51.                                             //$articletags = strip_tags(get_the_tag_list('',', ','')); echo $articletags;
  52.                                         }
  53.                                         else {
  54.                                             // IF NO TAGS
  55.                                         }
  56.                                     ?>
  57.                                 </ul><!-- /.work_meta-->
  58.  
  59.                                 <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { ?>
  60.  
  61.  
  62.                                     <ul class="work_features">
  63.                                         <li class="view_all"><a class="tooltip" title="full details" href="<?php echo the_permalink(); ?>">View All</a></li>
  64.                                         <li class="expand"><a rel="prettyPhoto[mixed]" class="expanded tooltip" title="preview" href="#prettyPhoto-<?php the_id(); ?>">Expand</a></li>
  65.                                         <li class="lightbox">
  66.                                             <?php if (has_post_thumbnail( $post->ID ) ): ?>
  67.                                             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
  68.                                                 <a class="work_lb tooltip" title="view in lightbox" href="<?php echo $image[0]; ?>" rel="prettyPhoto">Lightbox</a>
  69.                                             <?php endif; ?>
  70.                                         </li>
  71.                                     </ul><!-- /.work_features -->
  72.                                 </li>
  73.                             </ul>
  74.  
  75.                                 <?php } else { ?>
  76.  
  77.                                 <?php if ( 'work' == get_post_type() && has_term( 'portfolio', 'type' ) ) { // if the post is a portfolio item show the DESCRIPTION of the image ?>
  78.  
  79.                                     <ul class="work_features">
  80.                                         <li class="lightbox">
  81.                                             <?php if (has_post_thumbnail( $post->ID ) ): ?>
  82.                                             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
  83.                                                 <a class="work_lb tooltip" title="view in lightbox" href="<?php echo $image[0]; ?>" rel="prettyPhoto">Lightbox</a>
  84.                                             <?php endif; ?>
  85.                                         </li>
  86.                                     </ul><!-- /.work_features -->
  87.                                 </li>
  88.                             </ul>
  89.  
  90.                                 <?php } } ?>
  91.  
  92.                         <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { ?>
  93.  
  94.                             <aside class="work_expanded" id="prettyPhoto-<?php the_id(); ?>">
  95.  
  96.                                 <?php the_title('<h2>', '</h2>'); ?>
  97.  
  98.                                 <aside id="banner">
  99.  
  100.                                     <?php
  101.                                         $images = get_field('gallery');
  102.                                         if( $images ):
  103.                                     ?>
  104.                                         <div class="flexslider">
  105.                                             <ul class="slides">
  106.                                                 <?php foreach( $images as $image ): ?>
  107.                                                     <li>
  108.                                                         <img class="lazy" src="<?php echo $image['sizes']['Portfolio 1200']; ?>" alt="<?php echo $image['alt']; ?>" />
  109.                                                         <p class="flex-caption"><?php echo $image['caption']; ?></p>
  110.                                                     </li>
  111.                                                 <?php endforeach; ?>
  112.                                             </ul>
  113.                                         </div>
  114.                                     <?php endif; ?>
  115.  
  116.                                 </aside><!-- /#banner-->
  117.  
  118.                                 <aside id="left">
  119.  
  120.                                     <?php get_template_part( 'sidebar', 'work' ); ?>
  121.  
  122.                                 </aside><!-- /#left-->
  123.  
  124.                                 <aside id="right">
  125.  
  126.                                     <article>
  127.  
  128.                                         <?php the_content(); ?>
  129.  
  130.                                     </article>
  131.  
  132.                                 </aside><!-- /#right-->
  133.  
  134.                             </aside><!-- /.work_expand-->
  135.  
  136.                         <?php } ?>
  137.  
  138.                         </aside><!-- /.work_item-->
  139.  
  140.                     <?php endwhile; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement