Ultimate FAQ - Version 2.1.11

Version Description

(2022-03-01) = - Fixed an issue causing invalid schema (structured data).

Download this release

Release Info

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

Code changes from version 2.1.10 to 2.1.11

Files changed (3) hide show
  1. readme.txt +4 -1
  2. ultimate-faqs.php +2 -2
  3. views/View.class.php +29 -18
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Rustaurius, EtoileWebDesign
3
  Tags: faq, faqs, accordion, woocommerce faq, gutenberg faq, faq block
4
  Requires at least: 5.0
5
  Tested up to: 5.9
6
- Stable tag: 2.1.10
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -267,6 +267,9 @@ Video 3 - FAQs Ordering
267
 
268
  == Changelog ==
269
 
 
 
 
270
  = 2.1.10 (2022-02-23) =
271
  - Updated WPForms integration, so you can now specify a minimum character count before matching FAQs show.
272
  - Removed Gutenberg block code from the output of the post body in the structured data.
3
  Tags: faq, faqs, accordion, woocommerce faq, gutenberg faq, faq block
4
  Requires at least: 5.0
5
  Tested up to: 5.9
6
+ Stable tag: 2.1.11
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
267
 
268
  == Changelog ==
269
 
270
+ = 2.1.11 (2022-03-01) =
271
+ - Fixed an issue causing invalid schema (structured data).
272
+
273
  = 2.1.10 (2022-02-23) =
274
  - Updated WPForms integration, so you can now specify a minimum character count before matching FAQs show.
275
  - Removed Gutenberg block code from the output of the post body in the structured data.
ultimate-faqs.php CHANGED
@@ -6,7 +6,7 @@ Description: FAQ and accordion plugin with easy to use Gutenberg blocks, shortco
6
  Author URI: https://www.etoilewebdesign.com/
7
  Terms and Conditions: https://www.etoilewebdesign.com/plugin-terms-and-conditions/
8
  Text Domain: ultimate-faqs
9
- Version: 2.1.10
10
  WC requires at least: 3.0
11
  WC tested up to: 6.2
12
  */
@@ -46,7 +46,7 @@ class ewdufaqInit {
46
  define( 'EWD_UFAQ_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
47
  define( 'EWD_UFAQ_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
48
  define( 'EWD_UFAQ_TEMPLATE_DIR', 'ewd-ufaq-templates' );
49
- define( 'EWD_UFAQ_VERSION', '2.1.10' );
50
 
51
  define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
52
  define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
6
  Author URI: https://www.etoilewebdesign.com/
7
  Terms and Conditions: https://www.etoilewebdesign.com/plugin-terms-and-conditions/
8
  Text Domain: ultimate-faqs
9
+ Version: 2.1.11
10
  WC requires at least: 3.0
11
  WC tested up to: 6.2
12
  */
46
  define( 'EWD_UFAQ_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
47
  define( 'EWD_UFAQ_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
48
  define( 'EWD_UFAQ_TEMPLATE_DIR', 'ewd-ufaq-templates' );
49
+ define( 'EWD_UFAQ_VERSION', '2.1.11' );
50
 
51
  define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
52
  define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
views/View.class.php CHANGED
@@ -222,31 +222,42 @@ class ewdufaqView extends ewdufaqBase {
222
 
223
  foreach ( $this->faqs as $faq ) {
224
 
225
- $schema_object = array(
226
- '@type' => 'Question',
227
- 'name' => $faq->question,
228
- '@type' => 'Answer',
229
- 'text' => wp_strip_all_tags( $faq->answer ),
230
- 'acceptedAnswer' => array()
 
231
  );
232
 
233
- if ( ! empty( $faq->up_votes ) ) {
234
- $schema_object['acceptedAnswer']['upvoteCount'] = $faq->up_votes;
235
- }
236
 
237
- if ( ! empty( $faq->down_votes ) ) {
238
- $schema_object['acceptedAnswer']['downvoteCount'] = $faq->down_votes;
239
- }
240
 
241
- if ( ! empty( $faq->faq_author ) ) {
242
- $schema_object['acceptedAnswer']['author'] = array(
243
- '@type' => 'Person',
244
- 'name' => $faq->faq_author
245
- );
246
- }
247
 
248
  $ewd_ufaq_controller->schema_faq_data[] = $schema_object;
249
  }
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
252
  }
222
 
223
  foreach ( $this->faqs as $faq ) {
224
 
225
+ $schema_object = array(
226
+ '@type' => 'Question',
227
+ 'name' => $faq->question,
228
+ 'acceptedAnswer' => array(
229
+ '@type' => 'Answer',
230
+ 'text' => $this->strip_comment_tags( $faq->answer ),
231
+ )
232
  );
233
 
234
+ if ( ! empty( $faq->up_votes ) ) {
235
+ $schema_object['acceptedAnswer']['upvoteCount'] = $faq->up_votes;
236
+ }
237
 
238
+ if ( ! empty( $faq->down_votes ) ) {
239
+ $schema_object['acceptedAnswer']['downvoteCount'] = $faq->down_votes;
240
+ }
241
 
242
+ if ( ! empty( $faq->faq_author ) ) {
243
+ $schema_object['acceptedAnswer']['author'] = array(
244
+ '@type' => 'Person',
245
+ 'name' => $faq->faq_author
246
+ );
247
+ }
248
 
249
  $ewd_ufaq_controller->schema_faq_data[] = $schema_object;
250
  }
251
  }
252
 
253
+ /**
254
+ * Adds schema data about the FAQs being displayed
255
+ *
256
+ * @since 2.1.11
257
+ */
258
+ public function strip_comment_tags( $content ) {
259
+
260
+ return preg_replace( '/<!--(.|\s)*?-->/', '', $content );
261
+ }
262
+
263
  }