Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n7studios/34db0bbdb39f4be02217717c6b9f3cbe to your computer and use it in GitHub Desktop.
Save n7studios/34db0bbdb39f4be02217717c6b9f3cbe to your computer and use it in GitHub Desktop.
Comment Rating Field Pro Plugin: Manually Display / Output Post Rating: https://www.wpzinc.com/documentation/comment-rating-field-pro-plugin/developers-manual-post-rating-output/
<?php
/**
* For developers who want to display a Post's rating in a specific place, and do not wish to
* use Shortcodes, the below code can be used.
*
* There must be a Field Group configured at Comment Rating Field Pro > Field Groups to display
* rating fields for the Post Type of the Post ID specified.
*/
if ( function_exists( 'display_average_rating' ) ) {
display_average_rating( array(
'enabled' => 2,
'displaystyle' => 'grey',
'displayaverage' => 2,
'averageratingtext' => 'Average Rating:',
'displaytotalratings' => 1,
'totalratingsbefore' => 'From:',
'totalratingsafter' => 'Ratings',
'displaybreakdown' => 1,
'displayratingnumber' => 1,
'filtercomments' => 1,
'displaylink' => 1,
'id' => 100,
'cssID' => 'my-custom-html-id',
'cssClass' => 'my-custom-html-class',
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment