I am creating a part of my site where a user can enter a comment (review) and rate my web application. When a user enters a comment and rates my site out of 5, their comment will be available to the entire site (after approval).
I am not sure whether to go about this by making a database table for this and manually setting up user input fields into my custom DB table, or trying to use a wordpress plugin, or try and leverage the wordpress comment system in a mixture of both.
Can anyone provide an idea of the best way to go about doing this?
Answer
You can use comments and store individual ratings using add_comment_meta()
.
You would also probably want to store the rating average using add_post_meta()
, since it’s rather expensive to calculate it on the fly. Each time a rating is added or removed, you will have to update this average.
I don’t know if there are any plugins that do this already; haven’t searched.
Attribution
Source : Link , Question Author : JamesG , Answer Author : scribu