Ultimate FAQ - Version 2.0.16

Version Description

(2021-05-10) = - Fixed an issue in which the wrong URL was being generated for tag links when pretty permalink was enabled. - Added an option to disable front-page canonical redirects if you are using your homepage as your FAQ page.

Download this release

Release Info

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

Code changes from version 2.0.15 to 2.0.16

includes/Settings.class.php CHANGED
@@ -604,6 +604,17 @@ class ewdufaqSettings {
604
  )
605
  );
606
 
 
 
 
 
 
 
 
 
 
 
 
607
  $sap->add_setting(
608
  'ewd-ufaq-settings',
609
  'ewd-ufaq-premium-general',
604
  )
605
  );
606
 
607
+ $sap->add_setting(
608
+ 'ewd-ufaq-settings',
609
+ 'ewd-ufaq-premium-general',
610
+ 'toggle',
611
+ array(
612
+ 'id' => 'disable-homepage-canoncial-redirect',
613
+ 'title' => __( 'Disable Front-Page Canonical Redirects', 'ultimate-faqs' ),
614
+ 'description' => __( 'Should canonical redirects be disabled for the front page of your site? Only necessary if you\'re using the plugin on your homepage and have pretty permalinks enabled.', 'ultimate-faqs' )
615
+ )
616
+ );
617
+
618
  $sap->add_setting(
619
  'ewd-ufaq-settings',
620
  'ewd-ufaq-premium-general',
readme.txt CHANGED
@@ -264,6 +264,10 @@ Video 3 - FAQs Ordering
264
 
265
  == Changelog ==
266
 
 
 
 
 
267
  = 2.0.15 (2021-05-05) =
268
  - Fixed an issue in which the "FAQs per page" wasn't populating subsequent pages when "Group FAQs by Category" was enabled.
269
 
264
 
265
  == Changelog ==
266
 
267
+ = 2.0.16 (2021-05-10) =
268
+ - Fixed an issue in which the wrong URL was being generated for tag links when pretty permalink was enabled.
269
+ - Added an option to disable front-page canonical redirects if you are using your homepage as your FAQ page.
270
+
271
  = 2.0.15 (2021-05-05) =
272
  - Fixed an issue in which the "FAQs per page" wasn't populating subsequent pages when "Group FAQs by Category" was enabled.
273
 
ultimate-faqs.php CHANGED
@@ -7,7 +7,7 @@ Author: Etoile Web Design
7
  Author URI: http://www.EtoileWebDesign.com/plugins/ultimate-faqs/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: ultimate-faqs
10
- Version: 2.0.15
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) )
@@ -132,6 +132,7 @@ class ewdufaqInit {
132
 
133
  add_filter( 'init', array( $this, 'rewrite_rules' ) );
134
  add_filter( 'query_vars', array( $this, 'add_query_vars' ) );
 
135
 
136
  add_filter( 'the_content', array( $this, 'alter_faq_content' ) );
137
  add_action( 'wp_footer', array( $this, 'output_ld_json_content' ) );
@@ -153,7 +154,7 @@ class ewdufaqInit {
153
  * Run the options conversion function on update if necessary
154
  *
155
  * @since 2.0.0
156
- * @access protected
157
  * @return void
158
  */
159
  public function convert_options() {
@@ -166,7 +167,7 @@ class ewdufaqInit {
166
  * Adds in the rewrite rules used by the plugin and flushes rules if necessary
167
  *
168
  * @since 2.0.0
169
- * @access protected
170
  * @return void
171
  */
172
  public function rewrite_rules() {
@@ -192,7 +193,7 @@ class ewdufaqInit {
192
  * Adds in the query vars used by the plugin
193
  *
194
  * @since 2.0.0
195
- * @access protected
196
  * @return array
197
  */
198
  public function add_query_vars( $vars ) {
@@ -204,6 +205,27 @@ class ewdufaqInit {
204
  return $vars;
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Load files needed for views
209
  * @since 2.0.0
7
  Author URI: http://www.EtoileWebDesign.com/plugins/ultimate-faqs/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: ultimate-faqs
10
+ Version: 2.0.16
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) )
132
 
133
  add_filter( 'init', array( $this, 'rewrite_rules' ) );
134
  add_filter( 'query_vars', array( $this, 'add_query_vars' ) );
135
+ add_filter( 'redirect_canonical', array( $this, 'disable_canonical_redirect_for_front_page' ) );
136
 
137
  add_filter( 'the_content', array( $this, 'alter_faq_content' ) );
138
  add_action( 'wp_footer', array( $this, 'output_ld_json_content' ) );
154
  * Run the options conversion function on update if necessary
155
  *
156
  * @since 2.0.0
157
+ * @access public
158
  * @return void
159
  */
160
  public function convert_options() {
167
  * Adds in the rewrite rules used by the plugin and flushes rules if necessary
168
  *
169
  * @since 2.0.0
170
+ * @access public
171
  * @return void
172
  */
173
  public function rewrite_rules() {
193
  * Adds in the query vars used by the plugin
194
  *
195
  * @since 2.0.0
196
+ * @access public
197
  * @return array
198
  */
199
  public function add_query_vars( $vars ) {
205
  return $vars;
206
  }
207
 
208
+ /**
209
+ * Disables the automatic redirect that happens on the front-page
210
+ *
211
+ * @since 2.0.0
212
+ * @access public
213
+ * @return array
214
+ */
215
+ public function disable_canonical_redirect_for_front_page( $redirect ) {
216
+ global $ewd_ufaq_controller;
217
+
218
+ if ( empty( $ewd_ufaq_controller->settings->get_setting( 'disable-homepage-canoncial-redirect' ) ) ) { return $redirect; }
219
+
220
+ if ( ! is_page() ) { return $redirect; }
221
+
222
+ $front_page = get_option( 'page_on_front' );
223
+
224
+ if ( ! is_page( $front_page ) ) { return $redirect; }
225
+
226
+ return false;
227
+ }
228
+
229
  /**
230
  * Load files needed for views
231
  * @since 2.0.0
views/View.FAQ.class.php CHANGED
@@ -507,7 +507,7 @@ class ewdufaqViewFAQ extends ewdufaqView {
507
  public function get_category_value( $category ) {
508
  global $ewd_ufaq_controller;
509
 
510
- $category_url = $ewd_ufaq_controller->settings->get_setting( 'pretty-permalinks' ) ? add_query_arg( 'faq-category', urlencode( $category->slug ), $this->current_url ) : add_query_arg( 'include_category', urlencode( $category->slug ), $this->current_url );
511
 
512
  return '<a href="' . esc_attr( $category_url ) . '">' . $category->name . '</a>';
513
  }
@@ -531,7 +531,7 @@ class ewdufaqViewFAQ extends ewdufaqView {
531
  public function get_tag_value( $tag ) {
532
  global $ewd_ufaq_controller;
533
 
534
- $tag_url = $ewd_ufaq_controller->settings->get_setting( 'pretty-permalinks' ) ? add_query_arg( 'faq-tag', urlencode( $tag->slug ), $this->current_url ) : add_query_arg( 'include_tag', urlencode( $tag->slug ), $this->current_url );
535
 
536
  return '<a href="' . esc_attr( $tag_url ) . '">' . $tag->name . '</a>';
537
  }
507
  public function get_category_value( $category ) {
508
  global $ewd_ufaq_controller;
509
 
510
+ $category_url = $ewd_ufaq_controller->settings->get_setting( 'pretty-permalinks' ) ? $this->current_url . 'faq-category/' . urlencode( $category->slug ) . '/' : add_query_arg( 'include_category', urlencode( $category->slug ), $this->current_url );
511
 
512
  return '<a href="' . esc_attr( $category_url ) . '">' . $category->name . '</a>';
513
  }
531
  public function get_tag_value( $tag ) {
532
  global $ewd_ufaq_controller;
533
 
534
+ $tag_url = $ewd_ufaq_controller->settings->get_setting( 'pretty-permalinks' ) ? $this->current_url . 'faq-tag/' . urlencode( $tag->slug ) . '/' : add_query_arg( 'include_tag', urlencode( $tag->slug ), $this->current_url );
535
 
536
  return '<a href="' . esc_attr( $tag_url ) . '">' . $tag->name . '</a>';
537
  }