From a3951de9a750f9bd61ce00a088cdc7b255150c57 Mon Sep 17 00:00:00 2001
From: David Cramer
Date: Mon, 7 May 2018 09:35:11 +0200
Subject: [PATCH 1/2] use select field for ratings if IE11
---
assets/css/adventure.css | 8 ++++++-
includes/functions.php | 47 +++++++++++++++++++++++++++++++++-------
2 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/assets/css/adventure.css b/assets/css/adventure.css
index f51d669..31a056f 100644
--- a/assets/css/adventure.css
+++ b/assets/css/adventure.css
@@ -2,4 +2,10 @@
.comment-review {
width: 100%;
-}
\ No newline at end of file
+}
+
+.comment-form .comment-form-rating-select {
+ width: 50%;
+ padding-right: 15px;
+ margin-bottom: 0;
+}
diff --git a/includes/functions.php b/includes/functions.php
index c457579..fdfe1b5 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -158,22 +158,53 @@ function amp_travel_enqueue_styles() {
}
add_action( 'wp_enqueue_scripts', 'amp_travel_enqueue_styles' );
+
/**
- * Add rating field to comments.
+ * Add star rating field to comments.
*/
-function amp_travel_comment_rating_field() {
+function amp_travel_comment_star_rating_field() {
?>
+
+
+ ';
+}
+
+/**
+ * Add star or select rating field to comments.
+ */
+function amp_travel_comment_rating_field() {
+ global $is_IE;
+ if ( true === $is_IE ) {
+ // add the legacy select field type.
+ amp_travel_comment_select_rating_field();
+ } else {
+ // add the star rating field type.
+ amp_travel_comment_star_rating_field();
+ }
+}
add_action( 'comment_form_logged_in_after', 'amp_travel_comment_rating_field' );
add_action( 'comment_form_after_fields', 'amp_travel_comment_rating_field' );
From ce07dc6912f9d936808019b9ab0410464c884349 Mon Sep 17 00:00:00 2001
From: David Cramer
Date: Tue, 8 May 2018 06:19:11 +0200
Subject: [PATCH 2/2] correct esc_html__() as requested.
---
includes/functions.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/includes/functions.php b/includes/functions.php
index fdfe1b5..7440510 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -180,7 +180,7 @@ function amp_travel_comment_star_rating_field() {
* Add select rating field to comments.
*/
function amp_travel_comment_select_rating_field() {
- echo '