Skip to content

The Pronamic Reviews Ratings plugin for WordPress is a powerful, extendable reviews and ratings plugin.

Notifications You must be signed in to change notification settings

pronamic/wp-pronamic-reviews-ratings

Repository files navigation

The Pronamic Reviews Ratings plugin for WordPress is a powerful, extendable reviews and ratings plugin.

Register Rating Type

<?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' );

Post Type Support

<?php

function prefix_reviews_ratings_init() {
	add_post_type_support( 'page', 'pronamic_ratings' );
}

add_action( 'pronamic_reviews_ratings_init', 'prefix_reviews_ratings_init' );

Post Type Rating Types Support

<?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' );

Reviews Ratings Scores

<?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' );

Query Loop block

Add the pronamic-reviews-for-post keyword as a search filter parameter to show reviews for the current post.

Metadata

All the rating values are stored as meta data with the WordPress metadata API.

_pronamic_rating_value_$name
_pronamic_rating_count_$name

Schema.org

Tools for testing Schema.org markup

WooCommerce Reviews and Ratings solution

Other WordPress Reviews and Ratings solutions

JavaScript solutions