Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>More News</h2>
- <?php // Blog post query
- // store category in loc var via slug name
- $category = get_category_by_slug('uncategorized');
- // get category id from slug
- $catID = $category->term_id;
- // query posts using category id
- $more_news = new WP_Query( array('cat' => $catID, 'post__not_in' => array( $post->ID ) ) );
- //display posts
- if ($more_news->have_posts()) : while ($more_news->have_posts()) : $more_news->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( ($more_news->current_post + 1) < ($more_news->post_count) ) { ?><div class="clear"><hr /></div><?php } ?>
- </div><!-- /plain div -->
- </div><!-- /.post_class -->
- <?php // end of blog post loop and reset query
- endwhile; endif; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement