<?php //Gets category and author info
global $wp_query;
$cats = get_the_category();
$postAuthor = $wp_query->post->post_author;
$tempQuery = $wp_query;
$currentId = $post->ID;
// related category posts
$catlist = "";
forEach( $cats as $c ) {
if( $catlist != "" ) { $catlist .= ","; }
$catlist .= $c->cat_ID;
}
$newQuery = "posts_per_page=5&cat=" . $catlist;
query_posts( $newQuery );
$categoryPosts = "";
$count = 0;
if (have_posts()) {
while (have_posts()) {
the_post();
if( $count<4 && $currentId!=$post->ID) {
$count++;
$categoryPosts .= '[*]' . the_title( "", "", false ) . '';
}
}
}
$wp_query = $tempQuery;
?>
<h3>Other listings in category:</h3>
<ul><?php echo $categoryPosts; ?>[/list]
There are currently 1 users browsing this thread. (0 members and 1 guests)