Skip to content

Instantly share code, notes, and snippets.

@newswim
Created July 9, 2015 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newswim/f00f50a937b2fa446ba7 to your computer and use it in GitHub Desktop.
Save newswim/f00f50a937b2fa446ba7 to your computer and use it in GitHub Desktop.
<!-- Orig -->
<?php
/*
Template Name: Work Main
*/
get_header(); ?>
<!-- Grid Wall Init -->
<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/freewall.js"></script>
<script>
var wall;
$(function() {
wall = new freewall("#grid-wall"); // formerly #grid-wall
//
wall.reset({
selector: '.item',
animate: true,
cellW: function(width) {
var cellWidth = width / 3;
return cellWidth ;
},
cellH: 'auto',
gutterY: 0,
gutterX: 0,
fixSize: 0,
onResize: function() {
wall.fitWidth()
}
})//.refresh();
$("#grid-wall").html()
//wall.html();
wall.fitWidth();
// for scroll bar appear;
//$(window).trigger("resize");
//setTimeout(function(){
// wall.fitWidth();
//}, 1000)
/*
wall.container.find('.item img').load(function() {
wall.fitWidth();
}); */
//wall.filter(".size23");
$(".filter-label").click(function() {
$(".filter-label").removeClass("active");
var filter = $(this).addClass('active').data('filter');
if (filter) {
wall.filter(filter);
} else {
wall.unFilter();
}
});
})
</script>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<section class=" content-header work-header table">
<div class="table-row">
<div class="table-item">
<h1>Beautifully Built</h1>
<p class="callout">Featured Work & Case Studies</p>
</div>
</div>
</section>
<?php /* The loop */ ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<div id="work-ui-bar" class="hidden-xs" >
<?php
$terms = get_terms("tagportfolio", array( 'exclude' =>
array( 98, 99),
));
$count = count($terms);
echo '<ul id="work-filter">';
echo '<li><a href="#all" class="active filter-label">All</a></li>';
if ( $count > 0 )
{
foreach ( $terms as $term ) {
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<li><a class="filter-label" href="#'.$termname.'" title="'.$termname.'" data-filter=".'.$termname.'">'.$term->name.'</a></li>';
}
}
echo "</ul>";
?>
</div>
<?php
//query_posts("posts_per_page=5");
//wp_reset_postdata();
/* 'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob',
),
),*/
$args = array(
'post_type' => 'work',
'tax_query' => array(
array(
'taxonomy' => 'tagportfolio',
'field' => 'slug',
'terms' => 'work',
),
),
);
$loop = new WP_Query( $args );
// $loop = new WP_Query(array('post_type' => 'work', 'posts_per_page' => -1, 'cat' => 99));
// $loop = new WP_Query(array('category' => 'old'));
//$loop = posts_by_tag();
//$postArgs = array('post_type' => 'work', 'meta_query' => array(array('key' => 'work', 'value' => 'yes')));
//$posts = get_posts();
//echo "<pre>";
//print_r($posts);
//echo "</pre>";
$count =0;
?>
<section id="work-wrapper" class="nav-trigger">
<div id="grid-wall">
<?php if ( $loop ) :
while ( $loop->have_posts() ) : $loop->the_post() ?>
<?php
//print_r(wp_get_post_categories($post));
$terms = get_the_terms( $post->ID, 'tagportfolio' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
else :
$tax = '';
endif;
?>
<?php $infos = get_post_custom_values('_url'); ?>
<!-- To do -->
<div class="item <?php echo strtolower($tax); ?> branding-filt" style="width:640px;">
<a href="<?php the_permalink() ?>">
<img class="thumb" src="<?php $test = get_post_custom_values('custom_image'); echo wp_get_attachment_url( $test[0] );?>" />
<div class="overlay table">
<div class="table-row">
<div class="table-item">
<h3><?php the_title(); ?></h3>
<div class="line"></div>
<?php $post_meta_data = get_post_custom($post->ID, 'custom_url', true); ?>
<p class="excerpt"><?php echo $post_meta_data['custom_description'][0]; ?></p>
</div>
</div>
</div>
</a>
</div> <!-- /.item -->
<?php endwhile; else: ?>
<li class="error-not-found">Sorry, no portfolio entries found.</li>
<?php endif; ?>
</div>
<div class="clearfix"></div>
</section>
<section id="old-work-wrapper">
<div class="container">
<h3 class="text-center">Want to See More?</h3>
<p class="callout">Here's some work from the old days</p>
<div class="row">
<?php
//query_posts("posts_per_page=5");
//wp_reset_postdata();
/* 'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob',
),
),*/
$args = array(
'post_type' => 'work',
'tax_query' => array(
array(
'taxonomy' => 'tagportfolio',
'field' => 'slug',
'terms' => 'oldwork',
),
),
);
$loop = new WP_Query( $args );
// $loop = new WP_Query(array('post_type' => 'work', 'posts_per_page' => -1, 'cat' => 99));
// $loop = new WP_Query(array('category' => 'old'));
//$loop = posts_by_tag();
//$postArgs = array('post_type' => 'work', 'meta_query' => array(array('key' => 'work', 'value' => 'yes')));
//$posts = get_posts();
//echo "<pre>";
//print_r($posts);
//echo "</pre>";
$count =0;
?>
<?php if ( $loop ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
$terms = get_the_terms( $post->ID, 'tagportfolio' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
else :
$tax = '';
endif;
?>
<?php $infos = get_post_custom_values('_url'); ?>
<div class="item col-xs-6 col-sm-4 col-md-3 <?php echo strtolower($tax); ?>">
<a href="<?php the_permalink() ?>">
<img class="thumb" src="<?php $test = get_post_custom_values('custom_image'); echo wp_get_attachment_url( $test[0] );?>" />
</a>
</div>
<?php endwhile; else: ?>
<li class="error-not-found">Sorry, no portfolio entries found.</li>
<?php endif; ?>
</div>
</div>
</div>
</section>
<section class="start-project table">
<div class="table-row">
<div class="table-item">
<h3>Start Your Project</h3>
<p class="projectPlanner">Our simple and fast project planner will help us understand your needs quickly so we can get to creating sooner.</p>
<a class="btn"><span>get started</span></a>
</div>
</div>
</section>
</div><!-- #content -->
</div><!-- #primary -->
<div id="push"></div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment