gdrts_cf_render_in_comment_form($args = array())
Return rendered rating form for embedding into the comment form. This has to be added to the comment form if not, the plugin will not be able to process the comment when submitted to save the rating from the rating field. By default, the plugin adds the rating block based on the settings using the ‘comment_form_field_comment‘ filter for the WordPress comment form function. Also, when using auto embed, plugin populates the settings from the plugin settings, when you use the function on your own, you must provide all the settings through the function arguments.
Array $args contains several arguments.
- method: rating method to use for the rating block. Default ‘stars-rating’
- series: rating series to use for Emote and Multi rating methods. Default ‘null’.
- post_type: name of the post type comment form belongs too. This has to be supplied.
- is_required: is the rating required for the comment form to be submitted. Default: ‘true’.
- in_replies: should the rating block be visible when replying to comment or not. Default: ‘false’.
- label: label for the rating block field. Default: ‘Rating’.
$field = gdrts_cf_render_in_comment_form(array('post_type' => 'post', 'method' => 'stars-rating'));