bootstrap portfolio using custom post type

 <div class="main">
<div id="myBtnContainer">

 <?php
$taxonomy = 'ourprojects_category';
$terms = get_terms($taxonomy);
if ( $terms && !is_wp_error( $terms ) ) :
?>
                 <button class="btn active" onclick="filterSelection('all')"> Show all</button>

    <?php foreach ( $terms as $term ) { ?>
                       
                         <button class="btn" onclick="filterSelection('<?php echo $term->slug; ?>')"> <?php echo $term->name; ?></button>
                       
                        <?php } ?>
       <?php endif;?>
</div>

<!-- Portfolio Gallery Grid -->
<div class="row">
  <?php
$custom_terms = get_terms('ourprojects_category');
foreach($custom_terms as $custom_term) {
    wp_reset_query();
    $args = array('post_type' => 'ourprojects',
        'tax_query' => array(
            array(
                'taxonomy' => 'ourprojects_category',
                'field' => 'slug',
                'terms' => $custom_term->slug,
            ),
        ),
     );

     $loop = new WP_Query($args);
     if($loop->have_posts()) {
?>


 <?php while($loop->have_posts()) : $loop->the_post(); ?>

  <div class="column <?php echo $custom_term->slug; ?>">
 
 
 
    <div class="content">
      <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) ); ?>" alt="Mountains" style="width:100%">
      <h4><?php echo get_the_title(); ?></h4>
   
    </div>
   
         
   
  </div>
 
   <?php 
endwhile;
                       }
   }

                        ?>

</div>

</div>

Comments

Popular posts from this blog

dynamic create multiple ckeditor onclick event using jquery

get lat and long from city name using jquery

membership registration and login system in php