Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $this_post = $post;
- $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
- $posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);
- $count = 0;
- foreach ( $posts as $post ) {
- if ( $post->ID == $this_post->ID || $count == 5) {
- unset($posts[$count]);
- }else{
- $count ++;
- }
- }
- ?>
- <?php if ( $posts ) : ?>
- <div class="related_articles">
- <div class="rptitle">Other Posts in this Category</div>
- <ul>
- <?php foreach ( $posts as $post ) : ?>
- <li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('F jS, Y') ?>)</li>
- <?php endforeach // $posts as $post ?>
- </ul>
- </div>
- <?php endif // $posts ?>
- <?php
- $post = $this_post;
- unset($this_post);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement