Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save farik92/8198f0faa6d81744754fba64e22e7664 to your computer and use it in GitHub Desktop.

Select an option

Save farik92/8198f0faa6d81744754fba64e22e7664 to your computer and use it in GitHub Desktop.
<?php query_posts('post_type=post'); ?>
<?php $variable=0;?>
<div class="carousel-item active">
<div class="service_row row">
<?php while ( have_posts() ) : the_post(); ?>
<?php if(($variable+1)<5){ ?>
<div class="col-lg-3 col-md-6">
<div class="service_row__col ">
<div class="pimage">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
</div>
<h2 class="service_row__title"><?php the_title(); ?></h2>
</div>
</div>
<?php $variable+=1; ?>
<?php }else{ ?>
<?php $variable=1; ?>
</div>
</div>
<div class="carousel-item">
<div class="service_row row">
<div class="col-lg-3 col-md-6">
<div class="service_row__col ">
<div class="pimage">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
</div>
<h2 class="service_row__title"><?php the_title(); ?></h2>
</div>
</div>
<?php }?>
<?php endwhile; ?>
</div>
</div>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment