Advertisement
alchymyth

looop

Jul 21st, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.                 global $post;
  3.                 $currentPost = $post->ID;
  4.                  // store category in loc var via slug name
  5.                 $category = get_category_by_slug('upcoming-events');
  6.                 // get category id from slug
  7.                 $catID = $category->term_id;
  8.                
  9.                 $args = array( 'posts_per_page' => 3, 'post__not_in' => array($currentPost), 'cat' => $catID );
  10.                 $lastposts = new WP_Query( $args );
  11.                 while($lastposts->have_posts()) : $lastposts>the_post(); ?>
  12.                     <div <?php post_class(); ?>>
  13.                         <h3><?php the_title();?></h3>
  14.                             <div>
  15.                                 <?php // Post thumbnail conditional display.
  16.                                 if ( bootstrapwp_autoset_featured_img() !== false ) : ?>
  17.                                 <div>
  18.                                     <a href="<?php the_permalink(); ?>" title="<?php  the_title_attribute( 'echo=0' ); ?>">
  19.                                         <?php echo bootstrapwp_autoset_featured_img(); ?>
  20.                                     </a>
  21.                                 </div><!-- /inner plain div -->
  22.                                
  23.                                 <?php endif; ?>
  24.                                 <?php the_excerpt(); ?>
  25.                                 <a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
  26.                                     Read full story
  27.                                 </a>
  28.                                 <?php if( ($lastposts->current_post + 1) < ($lastposts->post_count) ) { ?><div class="clear"><hr /></div><?php }  ?>
  29.                             </div><!-- /plain div -->
  30.                     </div><!-- /.post_class -->
  31.                 <?php endwhile; wp_reset_postdata();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement