The Pronamic Reviews Ratings plugin for WordPress is a powerful, extendable reviews and ratings plugin.
<?php
function prefix_reviews_ratings_init() {
pronamic_register_rating_type( 'trustworthy', __( 'Trustworthy', 'text_domain' ) );
pronamic_register_rating_type( 'objective', __( 'Objective', 'text_domain' ) );
pronamic_register_rating_type( 'complete', __( 'Complete', 'text_domain' ) );
pronamic_register_rating_type( 'well_written', __( 'Well-written', 'text_domain' ) );
}
add_action( 'pronamic_reviews_ratings_init', 'prefix_reviews_ratings_init' );
<?php
function prefix_reviews_ratings_init() {
add_post_type_support( 'page', 'pronamic_ratings' );
}
add_action( 'pronamic_reviews_ratings_init', 'prefix_reviews_ratings_init' );
<?php
function prefix_init() {
register_post_type( 'book', array(
'public' => true,
'label' => __( 'Books', 'text_domain' ),
'pronamic_rating_types' => array(
'trustworthy',
'objective',
'complete',
'well_written',
),
) );
register_post_type( 'magazine', array(
'public' => true,
'label' => __( 'Magazines', 'text_domain' ),
'pronamic_rating_types' => array(
'trustworthy',
'well_written',
),
) );
}
add_action( 'init', 'prefix_init' );
<?php
function prefix_pronamic_reviews_ratings_scores( $scores ) {
$scores = array( 10, 8, 6, 4, 2 );
return $scores;
}
add_filter( 'pronamic_reviews_ratings_scores', 'prefix_pronamic_reviews_ratings_scores' );
Add the pronamic-reviews-for-post
keyword as a search filter parameter to show reviews for the current post.
All the rating values are stored as meta data with the WordPress metadata API.
_pronamic_rating_value_$name
_pronamic_rating_count_$name
- http://schema.org/reviews
- http://schema.org/Review
- http://schema.org/Rating
- http://schema.org/AggregateRating
- Google Structured Data Testing Tool
- Structured Data Linter
- Stack Overflow question - Tool for testing Schema.org markup
- https://github.com/woothemes/woocommerce/blob/v2.1.6/includes/class-wc-comments.php
- https://github.com/woothemes/woocommerce/blob/v2.1.6/templates/single-product-reviews.php#L52