Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $post;
- $currentPost = $post->ID;
- // store category in loc var via slug name
- $category = get_category_by_slug('upcoming-events');
- // get category id from slug
- $catID = $category->term_id;
- $args = array( 'posts_per_page' => 3, 'post__not_in' => array($currentPost), 'cat' => $catID );
- $lastposts = new WP_Query( $args );
- while($lastposts->have_posts()) : $lastposts>the_post(); ?>
- <div <?php post_class(); ?>>
- <h3><?php the_title();?></h3>
- <div>
- <?php // Post thumbnail conditional display.
- if ( bootstrapwp_autoset_featured_img() !== false ) : ?>
- <div>
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute( 'echo=0' ); ?>">
- <?php echo bootstrapwp_autoset_featured_img(); ?>
- </a>
- </div><!-- /inner plain div -->
- <?php endif; ?>
- <?php the_excerpt(); ?>
- <a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
- Read full story
- </a>
- <?php if( ($lastposts->current_post + 1) < ($lastposts->post_count) ) { ?><div class="clear"><hr /></div><?php } ?>
- </div><!-- /plain div -->
- </div><!-- /.post_class -->
- <?php endwhile; wp_reset_postdata();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement