Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
- $all_work = new WP_Query(array(
- 'post_type' => 'work',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'type',
- 'field' => 'slug',
- 'terms' => array('case-study', 'portfolio')
- ),
- ),
- 'posts_per_page' => '30',
- 'orderby' => 'title',
- 'order' => 'ASC',
- 'update_post_term_cache' => false,
- 'paged' => $paged
- )
- );
- while ( $all_work->have_posts() ) : $all_work->the_post();
- ?>
- <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 . ''); } } ?>">
- <ul>
- <li>
- <div class="img_wrap">
- <?php echo get_the_post_thumbnail( $post->ID, 'Work Gallery', array('class' => 'lazy') ); ?>
- </div><!-- /.img_wrap-->
- <ul class="work_meta">
- <li class="work_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
- <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { // show 25 characters from the content if the post is a case study ?>
- <li class="work_item_content"><?php the_excerpt(25); ?></li>
- <?php } else { ?>
- <?php if ( 'work' == get_post_type() && has_term( 'portfolio', 'type' ) ) { // if the post is a portfolio item show the DESCRIPTION of the image ?>
- <!--<li class="work_item_content"><?php echo get_post(get_post_thumbnail_id())->post_content; ?></li>-->
- <li class="work_item_content"><?php echo gds_get_excerpt($image->ID); ?></li>
- <?php } } ?>
- <?php
- if( has_tag() ) {
- // IF THE POST HAS TAGS
- the_tags('<li class="work_tags first">', '.</li><li class="work_tags">', '.</li>');
- //$articletags = strip_tags(get_the_tag_list('',', ','')); echo $articletags;
- }
- else {
- // IF NO TAGS
- }
- ?>
- </ul><!-- /.work_meta-->
- <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { ?>
- <ul class="work_features">
- <li class="view_all"><a class="tooltip" title="full details" href="<?php echo the_permalink(); ?>">View All</a></li>
- <li class="expand"><a rel="prettyPhoto[mixed]" class="expanded tooltip" title="preview" href="#prettyPhoto-<?php the_id(); ?>">Expand</a></li>
- <li class="lightbox">
- <?php if (has_post_thumbnail( $post->ID ) ): ?>
- <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
- <a class="work_lb tooltip" title="view in lightbox" href="<?php echo $image[0]; ?>" rel="prettyPhoto">Lightbox</a>
- <?php endif; ?>
- </li>
- </ul><!-- /.work_features -->
- </li>
- </ul>
- <?php } else { ?>
- <?php if ( 'work' == get_post_type() && has_term( 'portfolio', 'type' ) ) { // if the post is a portfolio item show the DESCRIPTION of the image ?>
- <ul class="work_features">
- <li class="lightbox">
- <?php if (has_post_thumbnail( $post->ID ) ): ?>
- <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
- <a class="work_lb tooltip" title="view in lightbox" href="<?php echo $image[0]; ?>" rel="prettyPhoto">Lightbox</a>
- <?php endif; ?>
- </li>
- </ul><!-- /.work_features -->
- </li>
- </ul>
- <?php } } ?>
- <?php if ( 'work' == get_post_type() && has_term( 'case-study', 'type' ) ) { ?>
- <aside class="work_expanded" id="prettyPhoto-<?php the_id(); ?>">
- <?php the_title('<h2>', '</h2>'); ?>
- <aside id="banner">
- <?php
- $images = get_field('gallery');
- if( $images ):
- ?>
- <div class="flexslider">
- <ul class="slides">
- <?php foreach( $images as $image ): ?>
- <li>
- <img class="lazy" src="<?php echo $image['sizes']['Portfolio 1200']; ?>" alt="<?php echo $image['alt']; ?>" />
- <p class="flex-caption"><?php echo $image['caption']; ?></p>
- </li>
- <?php endforeach; ?>
- </ul>
- </div>
- <?php endif; ?>
- </aside><!-- /#banner-->
- <aside id="left">
- <?php get_template_part( 'sidebar', 'work' ); ?>
- </aside><!-- /#left-->
- <aside id="right">
- <article>
- <?php the_content(); ?>
- </article>
- </aside><!-- /#right-->
- </aside><!-- /.work_expand-->
- <?php } ?>
- </aside><!-- /.work_item-->
- <?php endwhile; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement