Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( is_single()) {
- $categories = get_the_category();
- if ($categories) {
- $category = $categories[0]; //foreach ($categories as $category)
- $cat = $category->cat_ID;
- }
- $args=array(
- 'cat' => $cat,
- 'order' => 'DESC',
- 'post__not_in' => array($post->ID),
- 'posts_per_page'=>2,
- 'caller_get_posts'=>1
- );
- } else if(is_front_page()) {
- $args = array(
- 'order' => 'DESC',
- 'orderby' => 'date',
- 'posts_per_page'=>3,
- 'post_type' => 'post',
- 'caller_get_posts'=>1
- );
- }
- $my_query = null;
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) {
- while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <div class="col-xs-12 <?php if(is_front_page()) { echo 'col-sm-4 col-md-4'; } else { echo 'col-sm-6 col-md-6'; } ?>">
- <div class="recent-blog-post-item">
- <?php if(has_post_thumbnail()) : ?>
- <div class="blog-post-featured-img">
- <a href="<?php the_permalink(); ?>
- ">
- <div class="featured-banner" style="background: url(<?php the_post_thumbnail_url( 'full' ); ?> ) no-repeat center center; background-size: cover;">
- </div>
- </a>
- </div>
- <?php endif; ?>
- <div class="blog-post-content recent-meta-text">
- <div class="recent-meta-title">
- <a href="<? the_permalink()?>
- " rel="bookmark" title="
- <?php the_title(); ?>
- ">
- <h4>
- <?php the_title(); ?></h4>
- </a>
- </div>
- <div class="blog-post-meta">
- <div class="meta-text">
- <div class="meta-author">
- <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?></a>
- </div>
- <time class="meta-time" datetime="<?php echo date(DATE_W3C); ?>">
- <i class="fa fa-clock-o"></i> <?php the_time('F jS, Y'); ?>
- </time>
- </div>
- </div><!-- end blog post meta -->
- <div class="recent-meta-excerpt">
- <div class="excerpt-fix">
- <?php echo excerpt(25);?>
- </div>
- <a class="read-more" href="<?php the_permalink(); ?>
- ">Read More <i class="fa fa-long-arrow-right"></i>
- </a>
- </div>
- </div>
- <!-- end recent meta text -->
- </div>
- <!-- end recent blog post item -->
- </div>
- <?php endwhile; wp_reset_query();
- } else { ?>
- <div class="col-md-12">
- <?php _e('Sorry! There are no related articles based on this category.', 'roster-list'); ?>
- </div>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement