Skip to content

Instantly share code, notes, and snippets.

@junaidtk
Created January 17, 2019 17:16
Show Gist options
  • Save junaidtk/2dbba170f25ee02d3cf16f9ef544c803 to your computer and use it in GitHub Desktop.
Save junaidtk/2dbba170f25ee02d3cf16f9ef544c803 to your computer and use it in GitHub Desktop.
Portfolio section as masonry isotop
<div class="container-fluid">
<div class="row">
<!-- <div class="section-head text-center col-sm-12">
<h4>My Work</h4>
<p>...</p>
</div> -->
<?php
$terms = get_terms( array(
'taxonomy' => 'work-category',
'hide_empty' => false,
) );
if($terms){
//var_dump($terms);
?>
<!-- filter links -->
<div class="filtering text-center mb-30 col-sm-12">
<div class="filter">
<span data-filter='*' class="active">All</span>
<?php foreach ($terms as $key => $value) { ?>
<span data-filter='.<?php echo $value->slug ?>'><?php echo $value->name ?></span>
<?php } ?>
<!-- <span data-filter='.<?php echo $value->slug ?>'><?php echo $value->name ?></span>
<span data-filter='.<?php echo $value->slug ?>'><?php echo $value->name ?></span> -->
</div>
</div>
<?php } ?>
<div class="clearfix"></div>
<!-- gallery -->
<div class="gallery full-width">
<?php $arg = array(
'post_type' => 'portfolio',
'posts_per_page' => -1,
'order' => 'ASC',
);
$the_query1 = new WP_Query($arg); ?>
<?php if($the_query1->have_posts()){ ?>
<?php $i = 0; while ($the_query1->have_posts()) { $the_query1->the_post(); $i++;?>
<!-- gallery item -->
<?php if (has_post_thumbnail() ){ ?>
<?php
$ab_param1 = array('width' => 470, 'height' => 320);
$thumb_images1 = get_the_post_thumbnail_url();
$url_img1 = bfi_thumb($thumb_images1, $ab_param1);
?>
<?php $terms = get_the_terms( $post->ID , array( 'work-category') );
//var_dump($terms);
$cat_app = '';
$cat_name = '';
foreach ($terms as $key => $cat) {
//var_dump($cat);
$cat_app = $cat->slug.' ';
$cat_name = $cat->name.'';
}
//var_dump($cat_app);no-padding
?>
<div class="col-lg-3 col-md-6 items <?php echo $cat_app ?>">
<div class="item-img">
<img src="<?php echo $url_img1; ?>" alt="image">
<div class="item-img-overlay">
<div class="overlay-info full-width">
<p><?php echo $cat_app ?></p>
<h6><?php the_title(); ?></h6>
<a href="<?php echo get_the_post_thumbnail_url(); ?>" class="popimg">
<span class="icon"><i class="fas fa-search-plus"></i></span>
</a>
</div>
</div>
</div>
</div>
<?php } } } ?>
</div>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment