Ultimate FAQ - Version 1.5.20

Version Description

  • Added a new, simpler way to select which FAQs to display on a product page, directly from the edit product screen
Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Ultimate FAQ
Version 1.5.20
Comparing to
See all releases

Code changes from version 1.5.19 to 1.5.20

Functions/EWD_UFAQ_WooCommerce_Tab.php CHANGED
@@ -8,6 +8,9 @@ function EWD_UFAQ_Woo_FAQ_Tab( $tabs ) {
8
 
9
  $WooCommerce_FAQs = get_option("EWD_UFAQ_WooCommerce_FAQs");
10
 
 
 
 
11
  if ($Use_Product == "Yes" and is_object($product)) {$Product_Post = get_post($product->get_id());}
12
  else {$Product_Post = get_post(get_the_id());}
13
 
@@ -20,14 +23,17 @@ function EWD_UFAQ_Woo_FAQ_Tab( $tabs ) {
20
  if (get_term_by('name', $WC_Cat->name, 'ufaq-category')) {$UFAQ_WCCat_Category = true;}
21
  }
22
  }
23
-
24
- if (($UFAQ_Product_Category or $UFAQ_WCCat_Category) and $WooCommerce_FAQs == "Yes") {
 
 
 
25
  $tabs['faq_tab'] = array(
26
- 'title' => __( 'FAQs', 'EWD_UFAQ' ),
27
  'priority' => 50,
28
  'callback' => 'EWD_UFAQ_Woo_FAQ_Tab_Content'
29
  );
30
-
31
  return $tabs;
32
  }
33
 
@@ -37,23 +43,114 @@ function EWD_UFAQ_Woo_FAQ_Tab_Content() {
37
  global $product;
38
 
39
  $Use_Product = get_option("EWD_UFAQ_Use_Product");
40
-
 
 
 
41
  if ($Use_Product == "Yes") {$Product_Post = get_post($product->get_id());}
42
  else {$Product_Post = get_post(get_the_id());}
43
  $UFAQ_Product_Category = get_term_by('name', $Product_Post->post_title, 'ufaq-category');
44
 
45
- $WC_Cats = get_the_terms($Product_Post, 'product_cat');
46
- $UFAQ_WC_Category_List = "";
47
- if ($WC_Cats) {
48
- foreach ($WC_Cats as $WC_Cat) {
49
- $UFAQ_WC_Category = get_term_by('name', $WC_Cat->name, 'ufaq-category');
50
- if ($UFAQ_WC_Category) {$UFAQ_WC_Category_List .= "," . $UFAQ_WC_Category->slug;}
 
 
 
 
 
 
 
 
 
 
 
51
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
 
 
 
 
53
 
54
- echo '<h2>FAQs</h2>';
55
- echo do_shortcode("[ultimate-faqs include_category='". $UFAQ_Product_Category->slug . $UFAQ_WC_Category_List . "']");;
56
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
- ?>
 
 
8
 
9
  $WooCommerce_FAQs = get_option("EWD_UFAQ_WooCommerce_FAQs");
10
 
11
+ $WooCommerce_Tab_Label = get_option("EWD_UFAQ_WooCommerce_Tab_Label");
12
+ if ($WooCommerce_Tab_Label == "") {$WooCommerce_Tab_Label = __( 'FAQs', 'EWD_UFAQ' );}
13
+
14
  if ($Use_Product == "Yes" and is_object($product)) {$Product_Post = get_post($product->get_id());}
15
  else {$Product_Post = get_post(get_the_id());}
16
 
23
  if (get_term_by('name', $WC_Cat->name, 'ufaq-category')) {$UFAQ_WCCat_Category = true;}
24
  }
25
  }
26
+
27
+ $Current_FAQs = get_post_meta($Product_Post->ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
28
+ if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
29
+
30
+ if (($UFAQ_Product_Category or $UFAQ_WCCat_Category or !empty($Current_FAQs)) and $WooCommerce_FAQs == "Yes") {
31
  $tabs['faq_tab'] = array(
32
+ 'title' => $WooCommerce_Tab_Label,
33
  'priority' => 50,
34
  'callback' => 'EWD_UFAQ_Woo_FAQ_Tab_Content'
35
  );
36
+
37
  return $tabs;
38
  }
39
 
43
  global $product;
44
 
45
  $Use_Product = get_option("EWD_UFAQ_Use_Product");
46
+
47
+ $WooCommerce_Tab_Label = get_option("EWD_UFAQ_WooCommerce_Tab_Label");
48
+ if ($WooCommerce_Tab_Label == "") {$WooCommerce_Tab_Label = __( 'FAQs', 'EWD_UFAQ' );}
49
+
50
  if ($Use_Product == "Yes") {$Product_Post = get_post($product->get_id());}
51
  else {$Product_Post = get_post(get_the_id());}
52
  $UFAQ_Product_Category = get_term_by('name', $Product_Post->post_title, 'ufaq-category');
53
 
54
+ echo '<h2>' . $WooCommerce_Tab_Label . '</h2>';
55
+
56
+ $Current_FAQs = get_post_meta($Product_Post->ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
57
+ if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
58
+
59
+ if (!empty($Current_FAQs)) {
60
+ $FAQ_List = implode(",", $Current_FAQs);
61
+ echo do_shortcode("[ultimate-faqs post__in_string='". $FAQ_List . "']");
62
+ }
63
+ else {
64
+ $WC_Cats = get_the_terms($Product_Post, 'product_cat');
65
+ $UFAQ_WC_Category_List = "";
66
+ if ($WC_Cats) {
67
+ foreach ($WC_Cats as $WC_Cat) {
68
+ $UFAQ_WC_Category = get_term_by('name', $WC_Cat->name, 'ufaq-category');
69
+ if ($UFAQ_WC_Category) {$UFAQ_WC_Category_List .= "," . $UFAQ_WC_Category->slug;}
70
+ }
71
  }
72
+ echo do_shortcode("[ultimate-faqs include_category='". $UFAQ_Product_Category->slug . $UFAQ_WC_Category_List . "']");
73
+ }
74
+ }
75
+
76
+ function EWD_UFAQ_Add_FAQs_Product_Tab($array) {
77
+ $Add_Tab = array(
78
+ 'label' => __('FAQs', 'EWD_UFAQ'),
79
+ 'target' => 'ewd_ufaq_faqs',
80
+ 'class' => array()
81
+ );
82
+
83
+ $array['faqs'] = $Add_Tab;
84
+
85
+ return $array;
86
+ }
87
+ add_filter( 'woocommerce_product_data_tabs', 'EWD_UFAQ_Add_FAQs_Product_Tab', 10, 1 );
88
+
89
+ function EWD_UFAQ_WooCommerce_Product_Page_FAQs() {
90
+ global $post, $thepostid;
91
+
92
+ $WooCommerce_FAQs = get_option("EWD_UFAQ_WooCommerce_FAQs");
93
+ if ($WooCommerce_FAQs != "Yes") {return;}
94
+
95
+ $Current_FAQs = get_post_meta($thepostid, 'EWD_UFAQ_WC_Selected_FAQs', true );
96
+ if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
97
+
98
+ $All_FAQs = get_posts(array("numberposts" => -1, "post_type" => 'ufaq'));
99
+ $Categories = get_terms(array('taxonomy' => 'ufaq-category'));
100
+
101
+ echo "<div id='ewd_ufaq_faqs' class='panel woocommerce_options_panel'>";
102
+
103
+ echo "<div class='ewd-ufaq-explanation'>";
104
+ echo __("You can use the form below to select which FAQs to display for this product, or leave it blank to use the default category naming system.", 'EWD_UFAQ');
105
+ echo "</div>";
106
+
107
+ echo "<div id='ewd-ufaq-add-delete-faq-form-container'>";
108
+ echo "<div id='ewd-ufaq-add-faq-form-div'>";
109
+ echo "<form id='ewd-ufaq-add-faq-form'>";
110
+ echo "<select class='ewd-ufaq-category-filter' name='ewd-ufaq-category-filter'>";
111
+ echo "<option value=''>" . __("All Categories", 'EWD_UFAQ') . "</option>";
112
+ foreach ($Categories as $Category) {echo "<option value='" . $Category->term_id . "'>" . $Category->name . "</option>";}
113
+ echo "</select>";
114
+ echo "<table class='form-table ewd-ufaq-faq-add-table'>";
115
+ echo "<tr>";
116
+ echo "<th>" . __("Add?", 'EWD_UFAQ') . "</th>";
117
+ echo "<th>" . __("FAQ", 'EWD_UFAQ') . "</th>";
118
+ echo "</tr>";
119
+ foreach ($All_FAQs as $FAQ) {
120
+ echo "<tr class='ewd-ufaq-faq-row' data-faqid='" . $FAQ->ID . "'>";
121
+ echo "<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='" . $FAQ->ID . "'/></td>";
122
+ echo "<td>" . $FAQ->post_title . "</td>";
123
+ echo "</tr>";
124
  }
125
+ echo "</table>";
126
+ echo "</form>";
127
+ echo "<button class='ewd-ufaq-add-faq-button'>" . __('Add FAQs', 'EWD_UFAQ') . "</button>";
128
+ echo "</div>"; // ewd-ufaq-add-faq-form-div
129
 
130
+ echo "<div id='ewd-ufaq-delete-faq-form-div'>";
131
+ echo "<form id='ewd-ufaq-delete-faq-form'>";
132
+ echo "<input type='hidden' id='ewd-ufaq-post-id' value='" . $thepostid . "' />";
133
+ echo "<table class='form-table ewd-ufaq-delete-table'>";
134
+ echo "<tr>";
135
+ echo "<th>" . __("Delete?", 'EWD_UFAQ') . "</th>";
136
+ echo "<th>" . __("FAQ", 'EWD_UFAQ') . "</th>";
137
+ echo "</tr>";
138
+ foreach ($Current_FAQs as $FAQ_ID) {
139
+ $FAQ = get_post($FAQ_ID);
140
+
141
+ echo "<tr class='ewd-ufaq-faq-row ewd-ufaq-delete-faq-row' data-faqid='" . $FAQ_ID . "'>";
142
+ echo "<td><input type='checkbox' class='ewd-ufaq-delete-faq' name='Delete_FAQs[]' value='" . $FAQ_ID . "'/></td>";
143
+ echo "<td>" . $FAQ->post_title . "</td>";
144
+ echo "</tr>";
145
+ }
146
+ echo "</table>";
147
+ echo "</form>";
148
+ echo "<button class='ewd-ufaq-delete-faq-button'>" . __('Delete FAQs', 'EWD_UFAQ') . "</button>";
149
+ echo "</div>"; // ewd-ufaq-delete-faq-form-div
150
+ echo "</div>"; // ewd-ufaq-add-delete-faq-form-container
151
+ echo "<div>";
152
  }
153
 
154
+ add_action('woocommerce_product_data_panels', 'EWD_UFAQ_WooCommerce_Product_Page_FAQs');
155
+
156
+ ?>
Functions/Process_Ajax.php CHANGED
@@ -65,3 +65,78 @@ function EWD_UFAQ_Save_Order(){
65
 
66
  }
67
  add_action('wp_ajax_UFAQ_update_order','EWD_UFAQ_Save_Order');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  }
67
  add_action('wp_ajax_UFAQ_update_order','EWD_UFAQ_Save_Order');
68
+
69
+ function EWD_UFAQ_Add_WC_FAQs(){
70
+ $Post_ID = $_POST['Post_ID'];
71
+
72
+ $Current_FAQs = get_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
73
+ if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
74
+
75
+ $FAQs = json_decode(stripslashes_deep($_POST['FAQs']));
76
+ if (!is_array($FAQs)) {$FAQs = array();}
77
+
78
+ $Added_FAQs = array();
79
+ foreach ($FAQs as $FAQ) {
80
+ if (!in_array($FAQ, $Current_FAQs)) {
81
+ $Current_FAQs[] = $FAQ;
82
+
83
+ $FAQ_Post = get_post($FAQ);
84
+ $Added_FAQs[] = array("ID" => $FAQ, "Name" => $FAQ_Post->post_title);
85
+ }
86
+ }
87
+
88
+ update_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', $Current_FAQs);
89
+
90
+ echo json_encode($Added_FAQs);
91
+
92
+ die();
93
+ }
94
+ add_action('wp_ajax_ewd_ufaq_add_wc_faqs','EWD_UFAQ_Add_WC_FAQs');
95
+
96
+ function EWD_UFAQ_Delete_WC_FAQs(){
97
+ $Post_ID = $_POST['Post_ID'];
98
+
99
+ $Current_FAQs = get_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
100
+ if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
101
+
102
+ $FAQs = json_decode(stripslashes_deep($_POST['FAQs']));
103
+ if (!is_array($FAQs)) {$FAQs = array();}
104
+
105
+ $Remaining_FAQs = array_diff($Current_FAQs, $FAQs);
106
+
107
+ update_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', $Remaining_FAQs);
108
+
109
+ die();
110
+ }
111
+ add_action('wp_ajax_ewd_ufaq_delete_wc_faqs','EWD_UFAQ_Delete_WC_FAQs');
112
+
113
+ function EWD_UFAQ_WC_FAQ_Category() {
114
+ $Cat_ID = $_POST['Cat_ID'];
115
+
116
+ $args = array("numberposts" => -1, "post_type" => 'ufaq');
117
+ if ($Cat_ID != "") {
118
+ $args['tax_query'] = array(array(
119
+ 'taxonomy' => 'ufaq-category',
120
+ 'terms' => $Cat_ID
121
+ ));
122
+ }
123
+ $All_FAQs = get_posts($args);
124
+
125
+ $ReturnString .= "<table class='form-table ewd-ufaq-faq-add-table'>";
126
+ $ReturnString .= "<tr>";
127
+ $ReturnString .= "<th>" . __("Add?", 'EWD_UFAQ') . "</th>";
128
+ $ReturnString .= "<th>" . __("FAQ", 'EWD_UFAQ') . "</th>";
129
+ $ReturnString .= "</tr>";
130
+ foreach ($All_FAQs as $FAQ) {
131
+ $ReturnString .= "<tr class='ewd-ufaq-faq-row' data-faqid='" . $FAQ->ID . "'>";
132
+ $ReturnString .= "<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='" . $FAQ->ID . "'/></td>";
133
+ $ReturnString .= "<td>" . $FAQ->post_title . "</td>";
134
+ $ReturnString .= "</tr>";
135
+ }
136
+ $ReturnString .= "</table>";
137
+
138
+ echo $ReturnString;
139
+
140
+ die();
141
+ }
142
+ add_action('wp_ajax_ewd_ufaq_wc_faq_category','EWD_UFAQ_WC_FAQ_Category');
Functions/Update_Admin_Databases.php CHANGED
@@ -84,6 +84,7 @@ function EWD_UFAQ_UpdateOptions() {
84
  if (isset($_POST['search_label'])) {update_option('EWD_UFAQ_Search_Label', $_POST['search_label']);}
85
  if (isset($_POST['permalink_label'])) {update_option('EWD_UFAQ_Permalink_Label', $_POST['permalink_label']);}
86
  if (isset($_POST['back_to_top_label'])) {update_option('EWD_UFAQ_Back_To_Top_Label', $_POST['back_to_top_label']);}
 
87
 
88
  if (isset($_POST['thank_you_submit_label'])) {update_option('EWD_UFAQ_Thank_You_Submit_Label', $_POST['thank_you_submit_label']);}
89
  if (isset($_POST['submit_question_label'])) {update_option('EWD_UFAQ_Submit_Question_Label', $_POST['submit_question_label']);}
84
  if (isset($_POST['search_label'])) {update_option('EWD_UFAQ_Search_Label', $_POST['search_label']);}
85
  if (isset($_POST['permalink_label'])) {update_option('EWD_UFAQ_Permalink_Label', $_POST['permalink_label']);}
86
  if (isset($_POST['back_to_top_label'])) {update_option('EWD_UFAQ_Back_To_Top_Label', $_POST['back_to_top_label']);}
87
+ if (isset($_POST['woocommerce_tab_label'])) {update_option('EWD_UFAQ_WooCommerce_Tab_Label', $_POST['woocommerce_tab_label']);}
88
 
89
  if (isset($_POST['thank_you_submit_label'])) {update_option('EWD_UFAQ_Thank_You_Submit_Label', $_POST['thank_you_submit_label']);}
90
  if (isset($_POST['submit_question_label'])) {update_option('EWD_UFAQ_Submit_Question_Label', $_POST['submit_question_label']);}
Main.php CHANGED
@@ -7,7 +7,7 @@ Author: Etoile Web Design
7
  Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: EWD_UFAQ
10
- Version: 1.5.19
11
  */
12
 
13
  global $ewd_ufaq_message;
@@ -29,7 +29,7 @@ add_filter('upgrader_post_install', 'Set_EWD_UFAQ_Options');
29
  if ( is_admin() ){
30
  add_action('widgets_init', 'Update_EWD_UFAQ_Content');
31
  add_action('admin_notices', 'EWD_UFAQ_Error_Notices');
32
- add_action('admin_init', 'Add_EWD_UFAQ_Scripts');
33
  add_action('admin_head', 'EWD_UFAQ_Admin_Options');
34
  }
35
 
@@ -107,7 +107,9 @@ function EWD_UFAQ_plugin_settings_link($links) {
107
  $plugin = plugin_basename(__FILE__);
108
  add_filter("plugin_action_links_$plugin", 'EWD_UFAQ_plugin_settings_link' );
109
 
110
- function Add_EWD_UFAQ_Scripts() {
 
 
111
  if ((isset($_GET['post_type']) && $_GET['post_type'] == 'ufaq') or
112
  (isset($_GET['page']) && $_GET['page'] == 'EWD-UFAQ-Options')) {
113
  $url_one = plugins_url("ultimate-faqs/js/sorttable.js");
@@ -119,6 +121,12 @@ function Add_EWD_UFAQ_Scripts() {
119
  wp_enqueue_script('UFAQ Admin', $url_two, array('jquery'));
120
  wp_enqueue_script('spectrum', $url_three, array('jquery'));
121
  }
 
 
 
 
 
 
122
  }
123
 
124
  function EWD_UFAQ_Admin_Options() {
7
  Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: EWD_UFAQ
10
+ Version: 1.5.20
11
  */
12
 
13
  global $ewd_ufaq_message;
29
  if ( is_admin() ){
30
  add_action('widgets_init', 'Update_EWD_UFAQ_Content');
31
  add_action('admin_notices', 'EWD_UFAQ_Error_Notices');
32
+ add_action('admin_enqueue_scripts', 'Add_EWD_UFAQ_Scripts', 10, 1);
33
  add_action('admin_head', 'EWD_UFAQ_Admin_Options');
34
  }
35
 
107
  $plugin = plugin_basename(__FILE__);
108
  add_filter("plugin_action_links_$plugin", 'EWD_UFAQ_plugin_settings_link' );
109
 
110
+ function Add_EWD_UFAQ_Scripts($hook) {
111
+ global $post;
112
+
113
  if ((isset($_GET['post_type']) && $_GET['post_type'] == 'ufaq') or
114
  (isset($_GET['page']) && $_GET['page'] == 'EWD-UFAQ-Options')) {
115
  $url_one = plugins_url("ultimate-faqs/js/sorttable.js");
121
  wp_enqueue_script('UFAQ Admin', $url_two, array('jquery'));
122
  wp_enqueue_script('spectrum', $url_three, array('jquery'));
123
  }
124
+
125
+ if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php') {
126
+ if ($post->post_type == 'product') {
127
+ wp_enqueue_script('ewd-ufaq-wc-admin', plugins_url("js/ewd-ufaq-wc-admin.js", __FILE__, array('jquery')));
128
+ }
129
+ }
130
  }
131
 
132
  function EWD_UFAQ_Admin_Options() {
Shortcodes/DisplayFAQs.php CHANGED
@@ -76,6 +76,7 @@ function Display_FAQs($atts) {
76
  extract( shortcode_atts( array(
77
  'search_string' => "",
78
  'post__in' => "",
 
79
  'include_category' => "",
80
  'exclude_category' => "",
81
  'include_category_ids' => "",
@@ -100,6 +101,7 @@ function Display_FAQs($atts) {
100
  if ($post__in != "") {
101
  $post_id_array = json_decode(str_replace(array("&lsqb;", "&rsqb;"), array("[", "]"), $post__in));
102
  }
 
103
  else {$post_id_array = "";}
104
 
105
  if ($orderby == "") {$orderby = $Order_By_Setting;}
76
  extract( shortcode_atts( array(
77
  'search_string' => "",
78
  'post__in' => "",
79
+ 'post__in_string' => "",
80
  'include_category' => "",
81
  'exclude_category' => "",
82
  'include_category_ids' => "",
101
  if ($post__in != "") {
102
  $post_id_array = json_decode(str_replace(array("&lsqb;", "&rsqb;"), array("[", "]"), $post__in));
103
  }
104
+ elseif ($post__in_string != "") {$post_id_array = explode(",", $post__in_string);}
105
  else {$post_id_array = "";}
106
 
107
  if ($orderby == "") {$orderby = $Order_By_Setting;}
css/Admin.css CHANGED
@@ -720,3 +720,62 @@ input[name=toggle_symbol] {
720
  .ewd-ufaq-postbox-collapsible {
721
  overflow: hidden;
722
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
  .ewd-ufaq-postbox-collapsible {
721
  overflow: hidden;
722
  }
723
+
724
+
725
+
726
+ /***********************************************************
727
+ WOOCOMMERCE PRODUCT FAQ AREA
728
+ ***********************************************************/
729
+ .ewd-ufaq-explanation {
730
+ margin: 24px 2%;
731
+ font-size: 1.1em;
732
+ }
733
+ .ewd-ufaq-category-filter {
734
+ margin-bottom: 10px !important;
735
+ }
736
+ #ewd_ufaq_faqs.woocommerce_options_panel th {
737
+ padding: 15px 10px;
738
+ }
739
+ #ewd_ufaq_faqs.woocommerce_options_panel th:first-of-type {
740
+ width: 10%;
741
+ }
742
+ #ewd_ufaq_faqs.woocommerce_options_panel tr {
743
+ border-bottom: 1px solid #eee;
744
+ }
745
+ #ewd-ufaq-add-delete-faq-form-container {
746
+ position: relative;
747
+ float: left;
748
+ width: 100%;
749
+ clear: both;
750
+ }
751
+ #ewd-ufaq-add-faq-form-div, #ewd-ufaq-delete-faq-form-div {
752
+ position: relative;
753
+ float: left;
754
+ width: 45%;
755
+ padding: 0 2%;
756
+ }
757
+ #ewd-ufaq-delete-faq-form-div {
758
+ margin-top: 31px;
759
+ border-left: 1px solid #eee;
760
+ }
761
+ @media screen and (max-width: 1200px) {
762
+ #ewd-ufaq-add-faq-form-div, #ewd-ufaq-delete-faq-form-div {
763
+ width: 96%;
764
+ }
765
+ #ewd-ufaq-delete-faq-form-div {
766
+ border-left: none;
767
+ }
768
+ }
769
+ .ewd-ufaq-delete-faq-button, .ewd-ufaq-add-faq-button {
770
+ clear: both;
771
+ position: relative;
772
+ margin: 12px 0 12px 10px;
773
+ padding: 5px 8px;
774
+ border: none;
775
+ background: #bbb;
776
+ color: #fff;
777
+ cursor: pointer;
778
+ }
779
+ .ewd-ufaq-delete-faq-button:hover, .ewd-ufaq-add-faq-button:hover {
780
+ background: #ccc;
781
+ }
html/OptionsPage.php CHANGED
@@ -48,6 +48,7 @@
48
  $Search_Label = get_option("EWD_UFAQ_Search_Label");
49
  $Permalink_Label = get_option("EWD_UFAQ_Permalink_Label");
50
  $Back_To_Top_Label = get_option("EWD_UFAQ_Back_To_Top_Label");
 
51
 
52
  $Thank_You_Submit_Label = get_option("EWD_UFAQ_Thank_You_Submit_Label");
53
  $Submit_Question_Label = get_option("EWD_UFAQ_Submit_Question_Label");
@@ -687,6 +688,12 @@
687
  <input type='text' name='back_to_top_label' value='<?php echo $Back_To_Top_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
688
  </fieldset>
689
  </div>
 
 
 
 
 
 
690
  </div>
691
  </div>
692
  <div class='ufaq-subsection'>
48
  $Search_Label = get_option("EWD_UFAQ_Search_Label");
49
  $Permalink_Label = get_option("EWD_UFAQ_Permalink_Label");
50
  $Back_To_Top_Label = get_option("EWD_UFAQ_Back_To_Top_Label");
51
+ $WooCommerce_Tab_Label = get_option("EWD_UFAQ_WooCommerce_Tab_Label");
52
 
53
  $Thank_You_Submit_Label = get_option("EWD_UFAQ_Thank_You_Submit_Label");
54
  $Submit_Question_Label = get_option("EWD_UFAQ_Submit_Question_Label");
688
  <input type='text' name='back_to_top_label' value='<?php echo $Back_To_Top_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
689
  </fieldset>
690
  </div>
691
+ <div class='ufaq-option ufaq-label-option'>
692
+ <?php _e("WooCommerce Tab Label", 'EWD_UFAQ')?>
693
+ <fieldset>
694
+ <input type='text' name='woocommerce_tab_label' value='<?php echo $WooCommerce_Tab_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
695
+ </fieldset>
696
+ </div>
697
  </div>
698
  </div>
699
  <div class='ufaq-subsection'>
js/ewd-ufaq-wc-admin.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('.ewd-ufaq-add-faq-button').on('click', function(event) {
3
+ var Post_ID = jQuery('#ewd-ufaq-post-id').val();
4
+
5
+ var FAQs = [];
6
+ jQuery('.ewd-ufaq-add-faq').each(function() {
7
+ if (jQuery(this).is(':checked')) {FAQs.push(jQuery(this).val());}
8
+ jQuery(this).prop('checked', false);
9
+ });
10
+
11
+ var data = 'FAQs=' + JSON.stringify(FAQs) + '&Post_ID=' + Post_ID + '&action=ewd_ufaq_add_wc_faqs';
12
+ jQuery.post(ajaxurl, data, function(response) {
13
+ var Add_FAQs = jQuery.parseJSON(response);
14
+ jQuery(Add_FAQs).each(function(index, el) {
15
+ var HTML = "<tr class='ewd-ufaq-faq-row ewd-ufaq-delete-faq-row' data-faqid='" + el.ID + "'>";
16
+ HTML += "<td><input type='checkbox' class='ewd-ufaq-delete-faq' name='Delete_FAQs[]' value='" + el.ID + "'/></td>";
17
+ HTML += "<td>" + el.Name + "</td>";
18
+ HTML += "</tr>";
19
+ jQuery('.ewd-ufaq-delete-table tr:last').after(HTML);
20
+ });
21
+ });
22
+
23
+ event.preventDefault();
24
+ })
25
+ });
26
+
27
+ jQuery(document).ready(function() {
28
+ jQuery('.ewd-ufaq-delete-faq-button').on('click', function(event) {
29
+ var Post_ID = jQuery('#ewd-ufaq-post-id').val();
30
+
31
+ var FAQs = [];
32
+ jQuery('.ewd-ufaq-delete-faq').each(function() {
33
+ if (jQuery(this).is(':checked')) {FAQs.push(jQuery(this).val());}
34
+ jQuery(this).prop('checked', false);
35
+ });
36
+
37
+ var data = 'FAQs=' + JSON.stringify(FAQs) + '&Post_ID=' + Post_ID + '&action=ewd_ufaq_delete_wc_faqs';
38
+ jQuery.post(ajaxurl, data, function(response) {});
39
+
40
+ jQuery(FAQs).each(function(index, el) {
41
+ jQuery(".ewd-ufaq-delete-faq-row[data-faqid='" + el + "']").fadeOut('500', function() {jQuery(this).remove();});
42
+ });
43
+
44
+ event.preventDefault();
45
+ })
46
+ });
47
+
48
+ jQuery(document).ready(function() {
49
+ jQuery('.ewd-ufaq-category-filter').on('change', function() {
50
+ var Cat_ID = jQuery(this).val();
51
+
52
+ var data = 'Cat_ID=' + Cat_ID + '&action=ewd_ufaq_wc_faq_category';
53
+ jQuery.post(ajaxurl, data, function(response) {
54
+ jQuery('.ewd-ufaq-faq-add-table').remove();
55
+ jQuery('.ewd-ufaq-category-filter').after(response);
56
+ });
57
+ })
58
+ });
readme.txt CHANGED
@@ -247,6 +247,9 @@ Video 3 - FAQs Ordering
247
  13. View of FAQ custom fields in the admin
248
 
249
  == Changelog ==
 
 
 
250
  = 1.5.19 =
251
  - Minor admin area update
252
 
247
  13. View of FAQ custom fields in the admin
248
 
249
  == Changelog ==
250
+ = 1.5.20 =
251
+ - Added a new, simpler way to select which FAQs to display on a product page, directly from the edit product screen
252
+
253
  = 1.5.19 =
254
  - Minor admin area update
255