Number of stars are seen twice

[ad_1]

This is happening because your theme has the following javacript:

var thsn_selectwrap = function () {
  jQuery('select:not(#rating)').each(function () {
    jQuery(this).wrap('<div class=\'thsn-select\'></div>')
  })
}

That javascript is run on your page after Site Reviews has initialized itself (i.e. has rendered the stars).

Then, after the theme’s javascript is run, Site Reviews refreshes itself and sees that the rating SELECT (dropdown) is no longer where it should be and so re-initializes the rating.

Since that javascript skips SELECTs with a #rating id, a workaround is to add that ID to the rating field with a PHP code snippet (you can use the Code Snippets plugin to add it):

add_filter('site-reviews/review-form/fields/normalized', function ($fields) {
    if (isset($fields['rating']->field['path']) && 'rating' === $fields['rating']->field['path']) {
        $fields['rating']->field['id'] = 'rating';
    }
    return $fields;
});

However, this also means that you can only have one rating form on the page at a time. It also will not work with the Review Forms add-on if using custom ratings.

Thanks. After I’ve implemented the snippet, everything works fine.

BR

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer