GD Rating System introduces many rating related features, functions, shortcodes and widgets. And, it could be overwhelming at first to get through all the new terminology and understand what is what.
Rating type is used to classify rating objects. Each type is defined by ENTITY and NAME. To learn more about rating entities and types, check out this article. When used in functions, rating type is always defined with entity and name parameters. When used with shortcodes or widgets, it is defined with one parameter called type. Type includes both entity and name connected with dot. So, for entity posts and name post, parameter type would be ‘posts.post’. Here is the list of default rating types:
- entity: posts
name: post, page, attachment and any other custom post type.
- entity: comments
- entity: users
- entity: terms
name: post_tag, category, post_format and any other custom taxonomy
- entity: custom
Rating Item (or Rating Object)
Any object you can rate is called rating object. This can be post, comment, user, or anything else registered. Each rating object is defined (as far as the plugin is concerned) in two ways: through unique ITEM ID (usually in functions and shortcodes named: item_id) or through RATING TYPE and ID combination of values. Item ID can be found in the Ratings Items grid in the GD Rating System admin interface. Item ID is assigned at the time rating object is first entered the system, so if you remove items from database, next time same item (type/id) is requested it will have different Item ID.
For functions usually you have array with values:
$args = array( 'entity' => null, 'name' => null, 'id' => null, 'item_id' => null);
If you now item_id, you don’t need other parameters. If you don’t know item_id, you need to know rating type (entity and name) and id. Valid $args values for WordPress page (post type: page) with page ID 2, would be (no need for item_id):
$args = array( 'entity' => 'posts', 'name' => 'page', 'id' => 2);
This is type of rating used to rate rating objects. When you are setting rating method, you can use following values:
- stars-rating (for Stars Rating method)
- stars-review (for Stars Review method, Pro version of the plugin only)
- thumbs-rating (for Thumbs Rating method, Pro version of the plugin only)