• Hi Blaz,
    First of all thanks for a great plugin.
    I’m using it for a cinema. People can rate the movies.
    Each year the movies are in a different category.
    I would like to show the top rating list of just one year (category).
    In the documentation I found this:

    add_filter( 'rmp_top_rated_query', 'blazzdev_modify_top_rated_query' );
    
    function blazzdev_modify_top_rated_query( $args ) {
      if( is_category() ) {
        $category = get_the_category();
        if( $category ) { // category has posts
          $cat_id = $category[0]->cat_ID;
          $args['cat'] = $cat_id;
        } else { // no posts in category
          return array();
        }
      }
      return $args;
    }

    I changed is to

    add_filter( 'rmp_top_rated_query', 'blazzdev_modify_top_rated_query' );
    
    function blazzdev_modify_top_rated_query( $args ) {
    
        $category = '31';
        if( $category ) { // category has posts
          $cat_id = $category[0]->cat_ID;
          $args['cat'] = $cat_id;
        } else { // no posts in category
          return array();
        }
    
      return $args;
    }

    But thats nog the solution ?? cause nothing happens.
    Can you help me out? Thanks!!

    • This topic was modified 2 years, 7 months ago by inula.
  • The topic ‘Top rated posts widget’ is closed to new replies.