Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 29th, 2012  |  syntax: PHP  |  size: 0.78 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                                                 <?php
  2.                                                         $categories = get_the_category($post->ID);
  3.                                                                 if ($categories) {
  4.                                                                                 $category_ids = array();
  5.                                                                                         foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
  6.                                                
  7.        
  8.                                                         $args=array(
  9.                                                                 'category__in' => $thisid,
  10.                                                                 'post__not_in' => array($post->ID),
  11.                                                                 'showposts'=>-1, // Number of related posts that will be shown.
  12.                                                                 'caller_get_posts'=>1,
  13.                                                                 'exclude' => 4
  14.                                                         );
  15.                                                         $my_query = new wp_query($args);                                                       
  16.                                                         if( $my_query->have_posts() ) {          
  17.  
  18.                                                                         <ul>';
  19.                                                         while ($my_query->have_posts()) {
  20.                                                                         $my_query->the_post();
  21.                                                                        
  22.                                         ?>
  23.                                                                 <li><?php the_title(); ?></li>
  24.                                         <?php
  25.                                                 }
  26.                                         echo '</ul>';
  27.                                                 }
  28.                                                 }
  29.                                         ?>