Pastoid

The page you are looking at now is at this URL: http://pastoid.com/a7w

This paste was last updated on July 17, 2009 at 1:19 am.

Pasted Coderaw

<?php
//Gets category info
global $wp_query;
$cats = get_the_category();
$tempQuery = $wp_query;
$currentId = $post->ID;
 
// related category posts
$catlist = "";
forEach( $cats as $c ) {
  if( $catlist != "" ) { $catlist .= ","; }
  $catlist .= $c->cat_ID;
}
$newQuery = "cat=" . $catlist;
query_posts( $newQuery );
$categoryPosts = "";
$count = 0;
 
$items = array();
$topics = array();
 
if (have_posts()) {
  while (have_posts()) {
    if( $count<4 && $currentId!=$post->ID) {
      $item = new StdClass;
      $count++;
      $item->topic = get_post_custom_values("_video_description");
      $item->link = get_permalink();
      $item->the_post = the_post();
      $item->title = the_title( "", "", false )
      $items[] = $item;
      $topics[] = $item->topic;
  }
}
 
# Sort the posts by topic
array_multisort($topics, $items);
 
foreach ($items as $item) {
    $categoryPosts .= '
      <li><h2><a href="'.$item->link.'">' . $item->topic .'</h2><h3>'. $item->title .'</h3></a> </li>';
  }
}
 
$wp_query = $tempQuery;
?>
 
  <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
 
    <ul id="relatedposts"><?php echo $categoryPosts; ?></ul>
<?php endwhile;?>
 
 

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 3
Is this paste spam?
<Hide