Skip to content

Instantly share code, notes, and snippets.

@codeboxr
Last active August 29, 2015 13:56
Show Gist options
  • Save codeboxr/9065397 to your computer and use it in GitHub Desktop.
Save codeboxr/9065397 to your computer and use it in GitHub Desktop.
rating system direct function call
//The standalone rating form function is used to show the rating form using direct function call from theme or ther plugin.
/**
* This function add standalone rating form or custom rating form call.
* This will add both rating form and review list both based on form setting and permission
*
* Also it'll not be cached just like as the comment system of wp
*
* @param $form_id rating form id, if empty then will use the default one
* @param $post_id post id, if empty then will use the post id from the loop
* @param $theme_key if empty then will use from default setting
* @param $showreview shows review if true
*
* @return string
*/
//function standalonePostingRatingSystem( $form_id = '', $post_id = '', $theme_key = '', $showreview = true )
//Make sure you are in wordpress loop , to know more about loop please visit here https://codex.wordpress.org/The_Loop
if(function_exists('standalonePostingRatingSystem')):
$formid = '1';
$postid = $post->ID;
$rating = standalonePostingRatingSystem($formid, $postid, 'basic', true);
echo '<div>'.$rating.'</div>';
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment