WordPress.org

Support

Support » How-To and Troubleshooting » Storing and using Cat ID

Storing and using Cat ID

  • 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
    can anyone have a look that what is wrong ?

    <?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; ?>
  • The topic ‘Storing and using Cat ID’ is closed to new replies.
Skip to toolbar