Last active
November 10, 2017 11:29
-
-
Save n7studios/4c3520a88b040c7ef758c8539e31cd0c to your computer and use it in GitHub Desktop.
Comment Rating Field Pro Plugin: Get Post Rating Data: https://www.wpzinc.com/documentation/comment-rating-field-pro-plugin/developers-get-post-rating-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* For developers who want to directly access the numerical rating data for a Post, the below | |
* functions can be used. | |
*/ | |
/** | |
* Get the Post's Total Number of Ratings | |
* | |
* @param int $post_id Post ID | |
* @return int Total Number of Ratings | |
*/ | |
if ( function_exists( 'get_post_total_ratings' ) ) { | |
$result = get_post_total_ratings( $post_id ); | |
} | |
/** | |
* Get the Post's Average Rating | |
* | |
* @param int $post_id Post ID | |
* @return decimal Average Rating | |
*/ | |
if ( function_exists( 'get_post_average_rating' ) ) { | |
$result = get_post_average_rating( $post_id ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment