<?php if(have_posts()) : global $home_loop_title, $wp_query, $post; ?>
<div class="home-loop">
<div class="container">
<?php if(count($wp_query->posts) > 4) : ?>
<div class="nav">
<a href="#previous" class="prev">previous</a>
<a href="#next" class="next">next</a>
</div>
<?php endif; ?>
<h3><?php print $GLOBALS['home_loop_title'] ?></h3>
<div class="post-list-wrapper">
<ul class="post-list">
<?php while(have_posts()) : the_post(); $type = get_post_type_object(get_post_type()) ?>
<li <?php post_class(array('post')) ?>>
<?php
if($type->public) { ?><a href="<?php the_permalink() ?>"><?php }
elseif($post->post_type == 'client' && get_post_meta($post->ID, 'client_url', true)) { ?><a href="<?php print esc_url(get_post_meta($post->ID, 'client_url', true)) ?>"><?php }
?>
<?php if(has_post_thumbnail()) : ?>
<?php print get_the_post_thumbnail(get_the_ID(), 'home-loop') ?>
<?php else : ?>
<span class="placeholder"></span>
<?php endif; ?>
<?php if($type->public || ($post->post_type == 'client' && get_post_meta($post->ID, 'client_url', true))) print '</a>' ?>
<?php if($post->post_type != 'client') : ?>
<?php if($type->public) { ?><a href="<?php the_permalink() ?>"><?php } ?>
<h4><?php the_title() ?></h4>
<?php if($type->public) print '</a>' ?>
<?php endif ?>
<?php if(!empty($post->post_excerpt)) : ?>
<p><?php print $post->post_excerpt ?></p>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
</div>
<?php elseif($GLOBALS['pitch_theme_settings']['demo_mode']) : ?>
<?php
global $wp_query;
get_template_part('demo/homeloop', $wp_query->get('post_type'));
?>
<?php endif ?>