Skip to content

Instantly share code, notes, and snippets.

@talentedaamer
Created November 26, 2015 05:31
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 talentedaamer/3e1764320a2f0e3f9814 to your computer and use it in GitHub Desktop.
Save talentedaamer/3e1764320a2f0e3f9814 to your computer and use it in GitHub Desktop.
template file.
<div id="wrapper" class="properties-filter">
<div class="container">
<h1 class="section-heading text-center upper color-blue mb-30 font-48">Available Properties</h1>
<nav class="primary clearfix">
<ul class="properties-filter-menu list-inline mb-30">
<?php
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true,
'hierarchical' => true,
);
$terms = get_terms( 'property-category', $args);
if ( !empty( $terms ) ) {
echo '<li><a href="#" class="selected" data-filter="*">All</a></li>';
foreach ($terms as $key => $term ) {
echo '<li><a href="#" data-filter=".'.$term->slug.'">'.$term->name.'</a></li>';
}
}
?>
</ul>
</nav>
<section class="properties-filter-wrap main">
<div class="properties row">
<?php
$args = array(
'post_type' => 'properties',
'post_status' => 'publish',
'order' => 'ASC',
'posts_per_page' => -1,
);
$prop_query = new WP_Query( $args );
if ( $prop_query->have_posts() ) :
while ( $prop_query->have_posts() ) : $prop_query->the_post(); ?>
<?php
$terms = get_the_terms( get_the_ID(), 'property-category' );
$terms_array = array();
foreach ($terms as $key => $term) {
$terms_array[] = $term->slug;
}
$terms_classes = implode( ' ', $terms_array );
echo '<article class="entry col-md-4 col-sm-4 col-xs-6 '.$terms_classes.'">'; ?>
<?php if ( has_post_thumbnail() ): ?>
<?php the_post_thumbnail( 'wide-350', array( 'class' => 'img-responsive' ) ); ?>
<?php endif ?>
</article>
<?php endwhile;
endif; wp_reset_query(); ?>
</div>
</section>
<!-- END DEMO -->
<div class="clearfix"></div>
<div class="view-more-wrap">
<a href="#" class="btn btn-primary btn-lg">View More</a>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment