Top Posts from category

I am trying to display the top rated posts from a category, for that I need to pass the cat-id variable to wp-postratings

here is what i have done, but it isnt working, I suspect some problem with the code
is the cat_id being correctly saved and passed to get_highest_rated_category function

<?php function getCurrentCatID(){
global $wp_query;
if(is_category() || is_single()){
$cat_ID = get_query_var(‘cat’);
}
return $cat_id;
}

?>

<?php if (function_exists(‘get_highest_rated_category’)): ?>
<ul>
<?php get_highest_rated_category($cat_id); ?>
</ul>
<?php endif; ?>

OK
I also want the above to work on the post pages, for that I need to get the cat -d from the category slug
and than run the above
however, I am not sure about the if else if correct syntax in php

here is what I have , can someone look and tell what’s wrong?


<?php if (function_exists('get_highest_rated_category')):  ?>  
  
  <ul>
<?php if ( is_category()) 
   
   	$cat_id = get_query_var('cat');   
  
  
   get_highest_rated_category($cat_id); 
   
   

   </ul>  
<?php  else { if (is_single()) 
  
 <ul> 
$theCatId = get_term_by( 'slug' );
 get_highest_rated_category($theCatId);    ?> 
</ul> 
  
<?php endif; ?>

just in case someone is wondering
here is the correct working code

<?php if (function_exists('get_highest_rated_category')): ?>


   <ul>
   	<?php
   	$cat_id = get_query_var('cat');


       get_highest_rated_category($cat_id); ?>
   </ul>
<?php endif; ?>