Version Description
(2022-05-04) = - Added a setting to choose/set an FAQ page (as an alternative option to manually putting the block or shortcode on a page). - Implemented an option to highlight the search term in the results. - Multiple admins can now be emailed on question submission (comma-separated). - The "No Results Found" text is now wrapped in a selector, so you can style it separately, if desired. - FAQ Category Toggle now has a title attribute. It also has a tabindex="0" attribute so that the toggle div can be selected via the keyboard. - Added a small delay before fetching search results, so that, if someone is typing a query, less requests are being sent to the server. - Updated the X button that clears the search field, so that it sets the display back to no FAQs or all FAQs, depending on which option you have specified. - Fixed an issue causing date and datetime custom fields to show an incorrect input type on the FAQ edit screen. - FAQs set to Private now display on the front end when you are logged in to the site. - Removed some extra blank spaces that were showing in textarea edit fields.
Release Info
Developer | Rustaurius |
Plugin | Ultimate FAQ |
Version | 2.1.12 |
Comparing to | |
See all releases |
Code changes from version 2.1.11 to 2.1.12
- assets/css/ewd-ufaq.css +76 -1
- assets/js/ewd-ufaq.js +99 -27
- ewd-ufaq-templates/faqs-category-header.php +2 -2
- ewd-ufaq-templates/faqs-search.php +8 -1
- ewd-ufaq-templates/faqs-shortcode-args.php +1 -0
- ewd-ufaq-templates/submit-faq-field-faq-answer.php +1 -3
- includes/Ajax.class.php +15 -3
- includes/CustomPostTypes.class.php +20 -6
- includes/FAQ.class.php +1 -0
- includes/Notifications.class.php +7 -2
- includes/Query.class.php +1 -1
- includes/Settings.class.php +13 -5
- includes/template-functions.php +15 -15
- readme.txt +13 -1
- ultimate-faqs.php +24 -3
- views/View.FAQ.class.php +7 -0
- views/View.FAQSearch.class.php +2 -2
- views/View.FAQs.class.php +4 -1
@@ -53,9 +53,13 @@
|
|
53 |
.ewd-ufaq-faq-search{
|
54 |
margin:5px 0 !important;
|
55 |
}
|
56 |
-
.ewd-ufaq-search-
|
57 |
background: #f7ff00;
|
58 |
}
|
|
|
|
|
|
|
|
|
59 |
.ewd-otp-field-label{
|
60 |
width: auto !important;
|
61 |
}
|
@@ -614,4 +618,75 @@ Pagination
|
|
614 |
float: right;
|
615 |
}
|
616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
.ewd-ufaq-faq-search{
|
54 |
margin:5px 0 !important;
|
55 |
}
|
56 |
+
.ewd-ufaq-highlight-search-term {
|
57 |
background: #f7ff00;
|
58 |
}
|
59 |
+
.ewd-ufaq-no-results-found {
|
60 |
+
margin-top: 16px;
|
61 |
+
}
|
62 |
+
|
63 |
.ewd-otp-field-label{
|
64 |
width: auto !important;
|
65 |
}
|
618 |
float: right;
|
619 |
}
|
620 |
|
621 |
+
/* clears the 'X' from Internet Explorer */
|
622 |
+
#ewd-ufaq-jquery-ajax-search input[type=search]::-ms-clear {
|
623 |
+
display: none; width : 0; height: 0;
|
624 |
+
}
|
625 |
+
#ewd-ufaq-jquery-ajax-search input[type=search]::-ms-reveal {
|
626 |
+
display: none; width : 0; height: 0;
|
627 |
+
}
|
628 |
|
629 |
+
/* clears the 'X' from Chrome */
|
630 |
+
#ewd-ufaq-jquery-ajax-search input[type="search"]::-webkit-search-decoration,
|
631 |
+
#ewd-ufaq-jquery-ajax-search input[type="search"]::-webkit-search-cancel-button,
|
632 |
+
#ewd-ufaq-jquery-ajax-search input[type="search"]::-webkit-search-results-button,
|
633 |
+
#ewd-ufaq-jquery-ajax-search input[type="search"]::-webkit-search-results-decoration {
|
634 |
+
-webkit-appearance: none;
|
635 |
+
}
|
636 |
+
|
637 |
+
#ewd-ufaq-jquery-ajax-search * {
|
638 |
+
vertical-align: middle;
|
639 |
+
}
|
640 |
+
#ewd-ufaq-jquery-ajax-search .search-field {
|
641 |
+
display: inline-block;
|
642 |
+
margin: 15px;
|
643 |
+
position: relative;
|
644 |
+
}
|
645 |
+
#ewd-ufaq-jquery-ajax-search .search-field .ewd-ufaq-text-input {
|
646 |
+
margin: 0 !important;
|
647 |
+
padding: 8px 30px 8px 12px !important;
|
648 |
+
}
|
649 |
+
#ewd-ufaq-jquery-ajax-search .clear-field {
|
650 |
+
display: inline;
|
651 |
+
padding: 0;
|
652 |
+
margin: 0;
|
653 |
+
height: 100%;
|
654 |
+
background: transparent;
|
655 |
+
position: absolute;
|
656 |
+
top: 0;
|
657 |
+
right: 0;
|
658 |
+
color: black;
|
659 |
+
transition: width 0.35s, opacity 0.25s;
|
660 |
+
transform: translateX(15px);
|
661 |
+
opacity: 0;
|
662 |
+
width: 0;
|
663 |
+
}
|
664 |
+
#ewd-ufaq-jquery-ajax-search .clear-field.slide-in {
|
665 |
+
opacity: 1;
|
666 |
+
width: 30px;
|
667 |
+
animation: slide-in-right 0.5s forwards;
|
668 |
+
-webkit-animation: slide-in-right 0.5s forwards;
|
669 |
+
}
|
670 |
+
#ewd-ufaq-jquery-ajax-search .clear-field.slide-out {
|
671 |
+
opacity: 0;
|
672 |
+
width: 0;
|
673 |
+
animation: slide-out-right 0.5s forwards;
|
674 |
+
-webkit-animation: slide-out-right 0.5s forwards;
|
675 |
+
}
|
676 |
+
#ewd-ufaq-jquery-ajax-search .clear-field:hover,
|
677 |
+
#ewd-ufaq-jquery-ajax-search .clear-field:focus {
|
678 |
+
border-radius: 0;
|
679 |
+
}
|
680 |
+
@keyframes slide-in-right {
|
681 |
+
100% {
|
682 |
+
transform: translateX(0px);
|
683 |
+
}
|
684 |
+
}
|
685 |
+
@keyframes slide-out-right {
|
686 |
+
0% {
|
687 |
+
transform: translateX(0px);
|
688 |
+
}
|
689 |
+
100% {
|
690 |
+
transform: translateX(15px);
|
691 |
+
}
|
692 |
+
}
|
@@ -1,6 +1,69 @@
|
|
1 |
var filtering_running = false;
|
2 |
var wpforms_search_running = 'No';
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
jQuery(function(){ //DOM Ready
|
5 |
ufaqSetClickHandlers();
|
6 |
UFAQSetAutoCompleteClickHandlers();
|
@@ -93,11 +156,6 @@ function ufaqSetClickHandlers() {
|
|
93 |
|
94 |
jQuery( 'html, body' ).animate( { scrollTop: faq.offset().top - 20 }, 100 );
|
95 |
});
|
96 |
-
|
97 |
-
jQuery( '.ewd-ufaq-text-input ' ).on( 'search', function() {
|
98 |
-
|
99 |
-
ewd_ufaq_ajax_reload();
|
100 |
-
});
|
101 |
}
|
102 |
|
103 |
function UFAQSetAutoCompleteClickHandlers() {
|
@@ -111,7 +169,7 @@ function UFAQSetAutoCompleteClickHandlers() {
|
|
111 |
appendTo: '#ewd-ufaq-jquery-ajax-search',
|
112 |
select: function( event, ui ) {
|
113 |
jQuery( this ).val( ui.item.value );
|
114 |
-
|
115 |
}
|
116 |
});
|
117 |
|
@@ -174,29 +232,30 @@ function EWD_UFAQ_Hide_FAQ( faq_element ) {
|
|
174 |
|
175 |
jQuery(document).ready(function() {
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
ewd_ufaq_ajax_reload();
|
182 |
-
});
|
183 |
-
|
184 |
-
jQuery( '#ewd-ufaq-ajax-form' ).submit( function( event ) {
|
185 |
-
|
186 |
-
event.preventDefault();
|
187 |
|
188 |
-
|
|
|
|
|
|
|
189 |
});
|
190 |
|
191 |
-
jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input'
|
192 |
-
|
193 |
-
ewd_ufaq_ajax_reload();
|
194 |
});
|
195 |
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
|
|
200 |
|
201 |
if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.display_faq > 0 ) {
|
202 |
|
@@ -239,11 +298,15 @@ function ewd_ufaq_ajax_reload( pagination, append_results, search_string ) {
|
|
239 |
|
240 |
var faqs_only = 'No';
|
241 |
var faq_page = 0;
|
|
|
242 |
}
|
243 |
|
244 |
-
request_count = request_count + 1;
|
245 |
|
246 |
-
if (
|
|
|
|
|
|
|
247 |
|
248 |
var params = {};
|
249 |
|
@@ -257,6 +320,7 @@ function ewd_ufaq_ajax_reload( pagination, append_results, search_string ) {
|
|
257 |
params.current_url = current_url;
|
258 |
params.faqs_only = faqs_only;
|
259 |
params.faq_page = faq_page;
|
|
|
260 |
params.action = 'ewd_ufaq_search';
|
261 |
params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : '';
|
262 |
|
@@ -266,8 +330,16 @@ function ewd_ufaq_ajax_reload( pagination, append_results, search_string ) {
|
|
266 |
|
267 |
if ( response.data.request_count == request_count ) {
|
268 |
|
269 |
-
if ( append_results == 'Yes' ) {
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
jQuery( '.ewd-ufaq-bottom' ).data( 'max_page', response.data.max_page );
|
273 |
|
1 |
var filtering_running = false;
|
2 |
var wpforms_search_running = 'No';
|
3 |
|
4 |
+
var ajax_ctrlr = {
|
5 |
+
last_run: new Date(),
|
6 |
+
srch_str: '',
|
7 |
+
schdl_to_run_state: false,
|
8 |
+
schdl_to_run_delay: 250,
|
9 |
+
schdl_to_run_cntr: 0,
|
10 |
+
schdl_to_run_hndl: null,
|
11 |
+
schedule_to_run: function() {
|
12 |
+
ajax_ctrlr.schdl_to_run_cntr++;
|
13 |
+
|
14 |
+
if(ajax_ctrlr.schdl_to_run_cntr % 5 == 0) {
|
15 |
+
ajax_ctrlr.schdl_to_run_delay += 250;
|
16 |
+
ajax_ctrlr.schdl_to_run_reset();
|
17 |
+
}
|
18 |
+
|
19 |
+
if( ! ajax_ctrlr.schdl_to_run_state) {
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
let crnt_run = new Date();
|
24 |
+
|
25 |
+
if(crnt_run - ajax_ctrlr.last_run > ajax_ctrlr.schdl_to_run_delay) {
|
26 |
+
ajax_ctrlr.schdl_to_run_state = false;
|
27 |
+
ajax_ctrlr.schdl_to_run_cntr = 0;
|
28 |
+
ajax_ctrlr.last_run = new Date();
|
29 |
+
ewd_ufaq_ajax_reload();
|
30 |
+
}
|
31 |
+
},
|
32 |
+
schdl_to_run_reset: function () {
|
33 |
+
clearInterval(ajax_ctrlr.schdl_to_run_hndl);
|
34 |
+
ajax_ctrlr.schdl_to_run_hndl = setInterval(ajax_ctrlr.schedule_to_run, ajax_ctrlr.schdl_to_run_delay);
|
35 |
+
},
|
36 |
+
run_search_ajax: function( elm ) {
|
37 |
+
ajax_ctrlr.clear_field( elm );
|
38 |
+
|
39 |
+
let srch_str = jQuery(elm).val();
|
40 |
+
|
41 |
+
if( ajax_ctrlr.schdl_to_run_delay > 250 ) {
|
42 |
+
ajax_ctrlr.schdl_to_run_delay = 250;
|
43 |
+
ajax_ctrlr.schdl_to_run_reset();
|
44 |
+
}
|
45 |
+
|
46 |
+
if(srch_str != ajax_ctrlr.srch_str) {
|
47 |
+
ajax_ctrlr.srch_str = srch_str;
|
48 |
+
ajax_ctrlr.schdl_to_run_state = true;
|
49 |
+
ajax_ctrlr.last_run = new Date();
|
50 |
+
}
|
51 |
+
},
|
52 |
+
clear_field: function ( srch_elm ) {
|
53 |
+
let cf = jQuery(srch_elm).parent('.search-field').find('.clear-field').eq(0);
|
54 |
+
if( 0 < jQuery(srch_elm).val().length ) {
|
55 |
+
if( 'hidden' == cf.data('state') ) {
|
56 |
+
cf.data('state', 'visible');
|
57 |
+
cf.removeClass('slide-out').addClass('slide-in');
|
58 |
+
}
|
59 |
+
}
|
60 |
+
else {
|
61 |
+
cf.data('state', 'hidden');
|
62 |
+
cf.removeClass('slide-in').addClass('slide-out');
|
63 |
+
}
|
64 |
+
}
|
65 |
+
};
|
66 |
+
|
67 |
jQuery(function(){ //DOM Ready
|
68 |
ufaqSetClickHandlers();
|
69 |
UFAQSetAutoCompleteClickHandlers();
|
156 |
|
157 |
jQuery( 'html, body' ).animate( { scrollTop: faq.offset().top - 20 }, 100 );
|
158 |
});
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
function UFAQSetAutoCompleteClickHandlers() {
|
169 |
appendTo: '#ewd-ufaq-jquery-ajax-search',
|
170 |
select: function( event, ui ) {
|
171 |
jQuery( this ).val( ui.item.value );
|
172 |
+
ewd_ufaq_ajax_reload();
|
173 |
}
|
174 |
});
|
175 |
|
232 |
|
233 |
jQuery(document).ready(function() {
|
234 |
|
235 |
+
if( 0 < jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0).length ) {
|
236 |
+
ajax_ctrlr.schdl_to_run_hndl = setInterval(ajax_ctrlr.schedule_to_run, ajax_ctrlr.schdl_to_run_delay);
|
237 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
+
jQuery( '#ewd-ufaq-ajax-search-submit' ).click( function() {
|
240 |
+
jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', 1 );
|
241 |
+
let elm = jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0);
|
242 |
+
ajax_ctrlr.run_search_ajax( elm[0] );
|
243 |
});
|
244 |
|
245 |
+
jQuery( '#ewd-ufaq-jquery-ajax-search' ).on( 'keyup', '.ewd-ufaq-text-input', function() {
|
246 |
+
ajax_ctrlr.run_search_ajax( this );
|
|
|
247 |
});
|
248 |
|
249 |
+
// clear search field
|
250 |
+
jQuery( '#ewd-ufaq-jquery-ajax-search' ).on( 'click', '.clear-field', function() {
|
251 |
+
let elm = jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0);
|
252 |
+
jQuery(elm).val('');
|
253 |
+
ajax_ctrlr.run_search_ajax( elm );
|
254 |
+
});
|
255 |
|
256 |
+
jQuery( '.ewd-ufaq-text-input ' ).on( 'search', function() {
|
257 |
+
ajax_ctrlr.run_search_ajax( this );
|
258 |
+
});
|
259 |
|
260 |
if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.display_faq > 0 ) {
|
261 |
|
298 |
|
299 |
var faqs_only = 'No';
|
300 |
var faq_page = 0;
|
301 |
+
jQuery( '.ewd-ufaq-bottom' ).remove();
|
302 |
}
|
303 |
|
304 |
+
request_count = request_count + 1;
|
305 |
|
306 |
+
if ( jQuery( '.ewd-ufaq-text-input' ).length && 'yes' != show_on_load.toLocaleLowerCase() && search_string.length == 0 ) {
|
307 |
+
jQuery('.ewd-ufaq-faqs').html('');
|
308 |
+
return;
|
309 |
+
}
|
310 |
|
311 |
var params = {};
|
312 |
|
320 |
params.current_url = current_url;
|
321 |
params.faqs_only = faqs_only;
|
322 |
params.faq_page = faq_page;
|
323 |
+
params.show_on_load = show_on_load;
|
324 |
params.action = 'ewd_ufaq_search';
|
325 |
params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : '';
|
326 |
|
330 |
|
331 |
if ( response.data.request_count == request_count ) {
|
332 |
|
333 |
+
if ( append_results == 'Yes' ) {
|
334 |
+
jQuery( '.ewd-ufaq-faqs' ).append( response.data.output );
|
335 |
+
}
|
336 |
+
else {
|
337 |
+
jQuery( '.ewd-ufaq-faqs' ).html( response.data.output );
|
338 |
+
if( '' != response.data.pagination ) {
|
339 |
+
jQuery('.ewd-ufaq-faq-list .ewd-ufaq-bottom').remove();
|
340 |
+
jQuery('.ewd-ufaq-faq-list').append(response.data.pagination);
|
341 |
+
}
|
342 |
+
}
|
343 |
|
344 |
jQuery( '.ewd-ufaq-bottom' ).data( 'max_page', response.data.max_page );
|
345 |
|
@@ -1,8 +1,8 @@
|
|
1 |
<div id='ewd-ufaq-faq-category-<?php echo esc_attr( $this->get_category_slug() ); ?>' class='ewd-ufaq-faq-category'>
|
2 |
|
3 |
-
<div class='ewd-ufaq-faq-category-title <?php echo ( $this->get_option( 'faq-category-toggle' ) ? 'ewd-ufaq-faq-category-title-toggle' : '' ); ?>' >
|
4 |
|
5 |
-
<<?php echo esc_attr( $this->get_option( 'styling-category-heading-type' ) );
|
6 |
<?php echo esc_html( $this->get_category_name() ); ?>
|
7 |
<?php if ( $this->get_option( 'group-by-category-count' ) ) { ?> <span>(<?php echo esc_html( $this->get_category_count() ); ?>)</span><?php } ?>
|
8 |
</<?php echo esc_attr( $this->get_option( 'styling-category-heading-type' ) ); ?>>
|
1 |
<div id='ewd-ufaq-faq-category-<?php echo esc_attr( $this->get_category_slug() ); ?>' class='ewd-ufaq-faq-category'>
|
2 |
|
3 |
+
<div class='ewd-ufaq-faq-category-title <?php echo ( $this->get_option( 'faq-category-toggle' ) ? 'ewd-ufaq-faq-category-title-toggle' : '' ); ?>' <?php echo ( $this->get_option( 'faq-category-toggle' ) ? 'tabindex="0"' : '' ); ?> >
|
4 |
|
5 |
+
<<?php echo esc_attr( $this->get_option( 'styling-category-heading-type' ) ); ?> title="<?php echo esc_attr( sprintf( __( 'Click here to open %s', 'ultimate-faqs' ), $this->get_category_name() ) ); ?>">
|
6 |
<?php echo esc_html( $this->get_category_name() ); ?>
|
7 |
<?php if ( $this->get_option( 'group-by-category-count' ) ) { ?> <span>(<?php echo esc_html( $this->get_category_count() ); ?>)</span><?php } ?>
|
8 |
</<?php echo esc_attr( $this->get_option( 'styling-category-heading-type' ) ); ?>>
|
@@ -6,7 +6,14 @@
|
|
6 |
|
7 |
<?php $this->maybe_print_shortcode_args(); ?>
|
8 |
|
9 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
<?php $this->maybe_print_search_submit(); ?>
|
12 |
|
6 |
|
7 |
<?php $this->maybe_print_shortcode_args(); ?>
|
8 |
|
9 |
+
<div class="search-field">
|
10 |
+
<input
|
11 |
+
type='search'
|
12 |
+
class='ewd-ufaq-text-input <?php echo ( $this->get_option( 'auto-complete-titles' ) ? 'ewd-ufaq-text-auto-complete' : '' ); ?>'
|
13 |
+
placeholder='<?php echo esc_attr( $this->get_label( 'label-search-placeholder' ) ); ?>'
|
14 |
+
value='<?php echo ( isset( $_GET['faq_search_term'] ) ? esc_attr( $_GET['faq_search_term'] ) : '' ); ?>' />
|
15 |
+
<button type="button" class="clear-field" data-state="hidden">x</button>
|
16 |
+
</div>
|
17 |
|
18 |
<?php $this->maybe_print_search_submit(); ?>
|
19 |
|
@@ -1,3 +1,4 @@
|
|
|
|
1 |
<input type='hidden' name='include_category' value='<?php echo esc_attr( $this->include_category ); ?>' id='ewd-ufaq-include-category' />
|
2 |
<input type='hidden' name='exclude_category' value='<?php echo esc_attr( $this->exclude_category ); ?>' id='ewd-ufaq-exclude-category' />
|
3 |
<input type='hidden' name='orderby' value='<?php echo esc_attr( $this->orderby ); ?>' id='ewd-ufaq-orderby' />
|
1 |
+
<input type='hidden' name='show_on_load' value='<?php echo esc_attr( $this->show_on_load ); ?>' id='ewd-ufaq-show-on-load' />
|
2 |
<input type='hidden' name='include_category' value='<?php echo esc_attr( $this->include_category ); ?>' id='ewd-ufaq-include-category' />
|
3 |
<input type='hidden' name='exclude_category' value='<?php echo esc_attr( $this->exclude_category ); ?>' id='ewd-ufaq-exclude-category' />
|
4 |
<input type='hidden' name='orderby' value='<?php echo esc_attr( $this->orderby ); ?>' id='ewd-ufaq-orderby' />
|
@@ -4,9 +4,7 @@
|
|
4 |
<?php echo esc_html( $this->get_label( 'label-proposed-answer' ) ); ?>:
|
5 |
</label>
|
6 |
|
7 |
-
<textarea name='faq_answer' class='ewd-ufaq-faq-textarea' required>
|
8 |
-
<?php echo ( ! empty( $_POST['faq_answer'] ) ? esc_html( $_POST['faq_answer'] ) : '' ); ?>
|
9 |
-
</textarea>
|
10 |
|
11 |
<div id='ewd-ufaq-answer-explanation' class='ewd-ufaq-field-explanation'>
|
12 |
|
4 |
<?php echo esc_html( $this->get_label( 'label-proposed-answer' ) ); ?>:
|
5 |
</label>
|
6 |
|
7 |
+
<textarea name='faq_answer' class='ewd-ufaq-faq-textarea' required><?php echo ( ! empty( $_POST['faq_answer'] ) ? esc_html( $_POST['faq_answer'] ) : '' ); ?></textarea>
|
|
|
|
|
8 |
|
9 |
<div id='ewd-ufaq-answer-explanation' class='ewd-ufaq-field-explanation'>
|
10 |
|
@@ -50,7 +50,7 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
50 |
'order' => '',
|
51 |
'display_all_answers' => '',
|
52 |
'faq_page' => 1,
|
53 |
-
|
54 |
);
|
55 |
|
56 |
$query = new ewdufaqQuery( $faq_atts );
|
@@ -58,6 +58,8 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
58 |
$query->parse_request_args();
|
59 |
$query->prepare_args();
|
60 |
|
|
|
|
|
61 |
$faqs = new ewdufaqViewFAQs( $faq_atts );
|
62 |
|
63 |
$faqs->set_request_parameters();
|
@@ -68,6 +70,8 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
68 |
|
69 |
$faqs->create_faq_data();
|
70 |
|
|
|
|
|
71 |
ob_start();
|
72 |
|
73 |
$ewd_ufaq_controller->shortcode_printing = true;
|
@@ -78,11 +82,19 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
78 |
|
79 |
$output = ob_get_clean();
|
80 |
|
81 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
wp_send_json_success(
|
84 |
array(
|
85 |
-
'output'
|
|
|
86 |
'faq_count' => $faqs->faq_count,
|
87 |
'max_page' => $faqs->max_page,
|
88 |
'request_count' => intval( $_POST['request_count'] )
|
50 |
'order' => '',
|
51 |
'display_all_answers' => '',
|
52 |
'faq_page' => 1,
|
53 |
+
'post_count' => -1
|
54 |
);
|
55 |
|
56 |
$query = new ewdufaqQuery( $faq_atts );
|
58 |
$query->parse_request_args();
|
59 |
$query->prepare_args();
|
60 |
|
61 |
+
$faq_atts['search_string'] = isset( $_REQUEST['search_string'] ) ? sanitize_text_field( stripslashes( $_REQUEST['search_string'] ) ) : '';
|
62 |
+
|
63 |
$faqs = new ewdufaqViewFAQs( $faq_atts );
|
64 |
|
65 |
$faqs->set_request_parameters();
|
70 |
|
71 |
$faqs->create_faq_data();
|
72 |
|
73 |
+
$faqs->set_faq_properties();
|
74 |
+
|
75 |
ob_start();
|
76 |
|
77 |
$ewd_ufaq_controller->shortcode_printing = true;
|
82 |
|
83 |
$output = ob_get_clean();
|
84 |
|
85 |
+
$pagination = '';
|
86 |
+
if('yes' != $faqs->show_on_load && 2 > $faqs->faq_page) {
|
87 |
+
ob_start();
|
88 |
+
$faqs->maybe_print_pagination();
|
89 |
+
$pagination = ob_get_clean();
|
90 |
+
}
|
91 |
+
|
92 |
+
$output = $output ? $output : '<div class="ewd-ufaq-no-results-found">' . sprintf( $ewd_ufaq_controller->settings->get_setting( 'label-no-results-found' ), $query->args['search_string'] ) . '</div>';
|
93 |
|
94 |
wp_send_json_success(
|
95 |
array(
|
96 |
+
'output' => $output,
|
97 |
+
'pagination' => $pagination,
|
98 |
'faq_count' => $faqs->faq_count,
|
99 |
'max_page' => $faqs->max_page,
|
100 |
'request_count' => intval( $_POST['request_count'] )
|
@@ -156,7 +156,7 @@ class ewdufaqCustomPostTypes {
|
|
156 |
$meta_boxes = array(
|
157 |
|
158 |
// Add in the FAQ meta information
|
159 |
-
'
|
160 |
'id' => 'ufaq',
|
161 |
'title' => esc_html__( 'FAQ Details', 'ultimate-faqs' ),
|
162 |
'callback' => array( $this, 'show_faq_meta' ),
|
@@ -253,7 +253,7 @@ class ewdufaqCustomPostTypes {
|
|
253 |
<?php echo esc_html( $field_value ); ?>
|
254 |
</textarea>
|
255 |
|
256 |
-
<?php } elseif ( $faq_field->type == '
|
257 |
<?php if ( ! empty( $options ) ) { ?>
|
258 |
|
259 |
<select name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>'>
|
@@ -299,10 +299,22 @@ class ewdufaqCustomPostTypes {
|
|
299 |
|
300 |
<input type='date' class='ewd-ufaq-jquery-datepicker' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' />
|
301 |
|
302 |
-
<?php } elseif ( $faq_field->type == '
|
303 |
|
304 |
<input type='datetime-local' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' />
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
<?php } else { ?>
|
307 |
|
308 |
<input type='text' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' size='25' />
|
@@ -368,19 +380,21 @@ class ewdufaqCustomPostTypes {
|
|
368 |
|
369 |
if ( $faq_field->type == 'file' ) {
|
370 |
|
|
|
|
|
371 |
$uploaded_file = wp_handle_upload( $_FILES[ $input_name ], array( 'test_form' => false ) );
|
372 |
$field_value = $uploaded_file['url'];
|
373 |
}
|
374 |
elseif ( $faq_field->type == 'checkbox' ) {
|
375 |
|
376 |
$field_value = ( isset( $_POST[ $input_name ] ) and is_array( $_POST[ $input_name ] ) ) ? array_map( 'sanitize_text_field', $_POST[ $input_name ] ) : array();
|
377 |
-
update_post_meta( $post_id, 'Custom_Field_' . $faq_field->id, $field_value );
|
378 |
}
|
379 |
else {
|
380 |
|
381 |
$field_value = sanitize_text_field( $_POST[ $input_name ] );
|
382 |
-
update_post_meta( $post_id, 'Custom_Field_' . $faq_field->id, $field_value );
|
383 |
}
|
|
|
|
|
384 |
}
|
385 |
}
|
386 |
|
156 |
$meta_boxes = array(
|
157 |
|
158 |
// Add in the FAQ meta information
|
159 |
+
'faq_meta' => array (
|
160 |
'id' => 'ufaq',
|
161 |
'title' => esc_html__( 'FAQ Details', 'ultimate-faqs' ),
|
162 |
'callback' => array( $this, 'show_faq_meta' ),
|
253 |
<?php echo esc_html( $field_value ); ?>
|
254 |
</textarea>
|
255 |
|
256 |
+
<?php } elseif ( $faq_field->type == 'select' ) { ?>
|
257 |
<?php if ( ! empty( $options ) ) { ?>
|
258 |
|
259 |
<select name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>'>
|
299 |
|
300 |
<input type='date' class='ewd-ufaq-jquery-datepicker' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' />
|
301 |
|
302 |
+
<?php } elseif ( $faq_field->type == 'datetime' ) { ?>
|
303 |
|
304 |
<input type='datetime-local' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' />
|
305 |
+
|
306 |
+
<?php } elseif ( $faq_field->type == 'file' ) { ?>
|
307 |
+
|
308 |
+
<div class='ewd-ufaq-fields-page-file-preview'>
|
309 |
+
|
310 |
+
<span>
|
311 |
+
<?php _e( 'Current File:', 'ultimate-faqs' ); ?> <?php echo ! empty( $field_value ) ? esc_html( basename( $field_value ) ) : ''; ?>
|
312 |
+
</span>
|
313 |
+
|
314 |
+
</div>
|
315 |
+
|
316 |
+
<input type='file' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' />
|
317 |
+
|
318 |
<?php } else { ?>
|
319 |
|
320 |
<input type='text' id='ewd-ufaq-<?php echo esc_attr( $faq_field->name ); ?>' name='EWD_UFAQ_Custom_Field_<?php echo esc_attr( $faq_field->id ); ?>' value='<?php echo esc_attr( $field_value ); ?>' size='25' />
|
380 |
|
381 |
if ( $faq_field->type == 'file' ) {
|
382 |
|
383 |
+
if ( empty( $_FILES[ $input_name ]['name'] ) ) { continue; }
|
384 |
+
|
385 |
$uploaded_file = wp_handle_upload( $_FILES[ $input_name ], array( 'test_form' => false ) );
|
386 |
$field_value = $uploaded_file['url'];
|
387 |
}
|
388 |
elseif ( $faq_field->type == 'checkbox' ) {
|
389 |
|
390 |
$field_value = ( isset( $_POST[ $input_name ] ) and is_array( $_POST[ $input_name ] ) ) ? array_map( 'sanitize_text_field', $_POST[ $input_name ] ) : array();
|
|
|
391 |
}
|
392 |
else {
|
393 |
|
394 |
$field_value = sanitize_text_field( $_POST[ $input_name ] );
|
|
|
395 |
}
|
396 |
+
|
397 |
+
update_post_meta( $post_id, 'Custom_Field_' . $faq_field->id, $field_value );
|
398 |
}
|
399 |
}
|
400 |
|
@@ -108,6 +108,7 @@ class ewdufaqFAQ {
|
|
108 |
$this->faq_author = $faq_author ? $faq_author : $user->display_name;
|
109 |
$this->faq_author_email = get_post_meta( $this->ID, 'EWD_UFAQ_Post_Author_Email', true );
|
110 |
|
|
|
111 |
|
112 |
$this->up_votes = get_post_meta( $this->ID, 'FAQ_Up_Votes', true );
|
113 |
$this->down_votes = get_post_meta( $this->ID, 'FAQ_Down_Votes', true );
|
108 |
$this->faq_author = $faq_author ? $faq_author : $user->display_name;
|
109 |
$this->faq_author_email = get_post_meta( $this->ID, 'EWD_UFAQ_Post_Author_Email', true );
|
110 |
|
111 |
+
$this->views = get_post_meta( $this->ID, 'ufaq_view_count', true ) ? get_post_meta( $this->ID, 'ufaq_view_count', true ) : 0;
|
112 |
|
113 |
$this->up_votes = get_post_meta( $this->ID, 'FAQ_Up_Votes', true );
|
114 |
$this->down_votes = get_post_meta( $this->ID, 'FAQ_Down_Votes', true );
|
@@ -26,7 +26,7 @@ class ewdufaqNotifications {
|
|
26 |
|
27 |
if ( ! $ewd_ufaq_controller->settings->get_setting( 'admin-question-notification' ) ) { return; }
|
28 |
|
29 |
-
$
|
30 |
|
31 |
$faq_link = site_url() . '/wp-admin/post.php?post=' . $faq->ID . '&action=edit';
|
32 |
|
@@ -48,7 +48,12 @@ class ewdufaqNotifications {
|
|
48 |
|
49 |
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
26 |
|
27 |
if ( ! $ewd_ufaq_controller->settings->get_setting( 'admin-question-notification' ) ) { return; }
|
28 |
|
29 |
+
$admin_emails = $ewd_ufaq_controller->settings->get_setting( 'admin-notification-email' ) ? explode( ',', $ewd_ufaq_controller->settings->get_setting( 'admin-notification-email' ) ) : (array) get_option( 'admin_email' );
|
30 |
|
31 |
$faq_link = site_url() . '/wp-admin/post.php?post=' . $faq->ID . '&action=edit';
|
32 |
|
48 |
|
49 |
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
|
50 |
|
51 |
+
foreach ( $admin_emails as $admin_email ) {
|
52 |
+
|
53 |
+
$success = wp_mail( $admin_email, $subject_line, $message_body, $headers );
|
54 |
+
}
|
55 |
+
|
56 |
+
return $success;
|
57 |
}
|
58 |
|
59 |
/**
|
@@ -70,8 +70,8 @@ class ewdufaqQuery {
|
|
70 |
|
71 |
$defaults = array(
|
72 |
'post_type' => EWD_UFAQ_FAQ_POST_TYPE,
|
|
|
73 |
'posts_per_page' => -1,
|
74 |
-
'post_status' => 'publish',
|
75 |
'order' => 'DESC',
|
76 |
'paged' => 1,
|
77 |
);
|
70 |
|
71 |
$defaults = array(
|
72 |
'post_type' => EWD_UFAQ_FAQ_POST_TYPE,
|
73 |
+
'post_status' => 'publish',
|
74 |
'posts_per_page' => -1,
|
|
|
75 |
'order' => 'DESC',
|
76 |
'paged' => 1,
|
77 |
);
|
@@ -171,11 +171,19 @@ class ewdufaqSettings {
|
|
171 |
$sap->add_setting(
|
172 |
'ewd-ufaq-settings',
|
173 |
'ewd-ufaq-general',
|
174 |
-
'
|
175 |
-
array(
|
176 |
-
'id'
|
177 |
-
'title'
|
178 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
)
|
180 |
);
|
181 |
|
171 |
$sap->add_setting(
|
172 |
'ewd-ufaq-settings',
|
173 |
'ewd-ufaq-general',
|
174 |
+
'post',
|
175 |
+
array(
|
176 |
+
'id' => 'faq-page',
|
177 |
+
'title' => __( 'FAQs Page', 'ultimate-faqs' ),
|
178 |
+
'description' => __( 'Select a page on your site to automatically display all of the FAQs you have created. You can also use the blocks and shortcodes to display you FAQs on your site.', 'ultimate-faqs' ),
|
179 |
+
'blank_option' => true,
|
180 |
+
'args' => array(
|
181 |
+
'post_type' => 'page',
|
182 |
+
'posts_per_page' => -1,
|
183 |
+
'post_status' => 'publish',
|
184 |
+
'orderby' => 'title',
|
185 |
+
'order' => 'ASC',
|
186 |
+
),
|
187 |
)
|
188 |
);
|
189 |
|
@@ -8,7 +8,7 @@ function ewd_ufaq_faqs_shortcode( $atts ) {
|
|
8 |
global $ewd_ufaq_controller;
|
9 |
|
10 |
// Define shortcode attributes
|
11 |
-
$
|
12 |
'search_string' => '',
|
13 |
'post__in' => '',
|
14 |
'post__in_string' => '',
|
@@ -23,18 +23,18 @@ function ewd_ufaq_faqs_shortcode( $atts ) {
|
|
23 |
'order' => '',
|
24 |
'display_all_answers' => '',
|
25 |
'faq_page' => 1,
|
26 |
-
|
27 |
);
|
28 |
|
29 |
-
if ( empty( $
|
30 |
|
31 |
-
if ( empty( $
|
32 |
|
33 |
// Create filter so addons can modify the accepted attributes
|
34 |
-
$faq_atts = apply_filters( 'ewd_ufaq_faqs_shortcode_atts', $
|
35 |
|
36 |
// Extract the shortcode attributes
|
37 |
-
$args = shortcode_atts( $
|
38 |
|
39 |
$query = new ewdufaqQuery( $args );
|
40 |
|
@@ -68,7 +68,7 @@ function ewd_ufaq_search_faqs_shortcode( $atts ) {
|
|
68 |
if ( ! $ewd_ufaq_controller->permissions->check_permission( 'search' ) ) { return; }
|
69 |
|
70 |
// Define shortcode attributes
|
71 |
-
$
|
72 |
'include_category' => '',
|
73 |
'exclude_category' => '',
|
74 |
'show_on_load' => '',
|
@@ -80,15 +80,15 @@ function ewd_ufaq_search_faqs_shortcode( $atts ) {
|
|
80 |
'post_count' => -1,
|
81 |
);
|
82 |
|
83 |
-
if ( empty( $
|
84 |
|
85 |
-
if ( empty( $
|
86 |
|
87 |
// Create filter so addons can modify the accepted attributes
|
88 |
-
$
|
89 |
|
90 |
// Extract the shortcode attributes
|
91 |
-
$args = shortcode_atts( $
|
92 |
|
93 |
$query = new ewdufaqQuery( $args );
|
94 |
|
@@ -122,7 +122,7 @@ function ewd_ufaq_submit_faq_shortcode( $atts ) {
|
|
122 |
if ( ! $ewd_ufaq_controller->permissions->check_permission( 'submit-faq' ) ) { return; }
|
123 |
|
124 |
// Define shortcode attributes
|
125 |
-
$
|
126 |
'success_message' => '',
|
127 |
'submit_faq_form_title' => '',
|
128 |
'submit_faq_instructions' => '',
|
@@ -130,10 +130,10 @@ function ewd_ufaq_submit_faq_shortcode( $atts ) {
|
|
130 |
);
|
131 |
|
132 |
// Create filter so addons can modify the accepted attributes
|
133 |
-
$
|
134 |
|
135 |
// Extract the shortcode attributes
|
136 |
-
$args = shortcode_atts( $
|
137 |
|
138 |
// Handle FAQ submission
|
139 |
if ( isset( $_POST['submit_question'] ) ) {
|
@@ -189,7 +189,7 @@ function ewd_ufaq_faq_shortcode( $atts ) {
|
|
189 |
);
|
190 |
|
191 |
// Create filter so addons can modify the accepted attributes
|
192 |
-
$faq_atts = apply_filters( '
|
193 |
|
194 |
$args = shortcode_atts( $faq_atts, $atts );
|
195 |
|
8 |
global $ewd_ufaq_controller;
|
9 |
|
10 |
// Define shortcode attributes
|
11 |
+
$faqs_atts = array(
|
12 |
'search_string' => '',
|
13 |
'post__in' => '',
|
14 |
'post__in_string' => '',
|
23 |
'order' => '',
|
24 |
'display_all_answers' => '',
|
25 |
'faq_page' => 1,
|
26 |
+
'post_count' => -1
|
27 |
);
|
28 |
|
29 |
+
if ( empty( $faqs_atts['orderby'] ) ) { $faqs_atts['orderby'] = $ewd_ufaq_controller->settings->get_setting( 'faq-order-by' ); }
|
30 |
|
31 |
+
if ( empty( $faqs_atts['order'] ) ) { $faqs_atts['order'] = $ewd_ufaq_controller->settings->get_setting( 'faq-order' ); }
|
32 |
|
33 |
// Create filter so addons can modify the accepted attributes
|
34 |
+
$faq_atts = apply_filters( 'ewd_ufaq_faqs_shortcode_atts', $faqs_atts );
|
35 |
|
36 |
// Extract the shortcode attributes
|
37 |
+
$args = shortcode_atts( $faqs_atts, $atts );
|
38 |
|
39 |
$query = new ewdufaqQuery( $args );
|
40 |
|
68 |
if ( ! $ewd_ufaq_controller->permissions->check_permission( 'search' ) ) { return; }
|
69 |
|
70 |
// Define shortcode attributes
|
71 |
+
$faq_search_atts = array(
|
72 |
'include_category' => '',
|
73 |
'exclude_category' => '',
|
74 |
'show_on_load' => '',
|
80 |
'post_count' => -1,
|
81 |
);
|
82 |
|
83 |
+
if ( empty( $faq_search_atts['orderby'] ) ) { $faq_search_atts['orderby'] = $ewd_ufaq_controller->settings->get_setting( 'faq-order-by' ); }
|
84 |
|
85 |
+
if ( empty( $faq_search_atts['order'] ) ) { $faq_search_atts['order'] = $ewd_ufaq_controller->settings->get_setting( 'faq-order' ); }
|
86 |
|
87 |
// Create filter so addons can modify the accepted attributes
|
88 |
+
$faq_search_atts = apply_filters( 'ewd_ufaq_faq_search_shortcode_atts', $faq_search_atts );
|
89 |
|
90 |
// Extract the shortcode attributes
|
91 |
+
$args = shortcode_atts( $faq_search_atts, $atts );
|
92 |
|
93 |
$query = new ewdufaqQuery( $args );
|
94 |
|
122 |
if ( ! $ewd_ufaq_controller->permissions->check_permission( 'submit-faq' ) ) { return; }
|
123 |
|
124 |
// Define shortcode attributes
|
125 |
+
$submit_faq_atts = array(
|
126 |
'success_message' => '',
|
127 |
'submit_faq_form_title' => '',
|
128 |
'submit_faq_instructions' => '',
|
130 |
);
|
131 |
|
132 |
// Create filter so addons can modify the accepted attributes
|
133 |
+
$submit_faq_atts = apply_filters( 'ewd_ufaq_submit_faq_shortcode_atts', $submit_faq_atts );
|
134 |
|
135 |
// Extract the shortcode attributes
|
136 |
+
$args = shortcode_atts( $submit_faq_atts, $atts );
|
137 |
|
138 |
// Handle FAQ submission
|
139 |
if ( isset( $_POST['submit_question'] ) ) {
|
189 |
);
|
190 |
|
191 |
// Create filter so addons can modify the accepted attributes
|
192 |
+
$faq_atts = apply_filters( 'ewd_ufaq_faq_shortcode', $faq_atts );
|
193 |
|
194 |
$args = shortcode_atts( $faq_atts, $atts );
|
195 |
|
@@ -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.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -267,6 +267,18 @@ Video 3 - FAQs Ordering
|
|
267 |
|
268 |
== Changelog ==
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
= 2.1.11 (2022-03-01) =
|
271 |
- Fixed an issue causing invalid schema (structured data).
|
272 |
|
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.12
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
267 |
|
268 |
== Changelog ==
|
269 |
|
270 |
+
= 2.1.12 (2022-05-04) =
|
271 |
+
- Added a setting to choose/set an FAQ page (as an alternative option to manually putting the block or shortcode on a page).
|
272 |
+
- Implemented an option to highlight the search term in the results.
|
273 |
+
- Multiple admins can now be emailed on question submission (comma-separated).
|
274 |
+
- The "No Results Found" text is now wrapped in a selector, so you can style it separately, if desired.
|
275 |
+
- FAQ Category Toggle now has a title attribute. It also has a tabindex="0" attribute so that the toggle div can be selected via the keyboard.
|
276 |
+
- Added a small delay before fetching search results, so that, if someone is typing a query, less requests are being sent to the server.
|
277 |
+
- Updated the X button that clears the search field, so that it sets the display back to no FAQs or all FAQs, depending on which option you have specified.
|
278 |
+
- Fixed an issue causing date and datetime custom fields to show an incorrect input type on the FAQ edit screen.
|
279 |
+
- FAQs set to Private now display on the front end when you are logged in to the site.
|
280 |
+
- Removed some extra blank spaces that were showing in textarea edit fields.
|
281 |
+
|
282 |
= 2.1.11 (2022-03-01) =
|
283 |
- Fixed an issue causing invalid schema (structured data).
|
284 |
|
@@ -6,9 +6,9 @@ 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 |
WC requires at least: 3.0
|
11 |
-
WC tested up to: 6.
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
@@ -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.
|
50 |
|
51 |
define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
|
52 |
define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
|
@@ -138,6 +138,7 @@ class ewdufaqInit {
|
|
138 |
add_filter( 'redirect_canonical', array( $this, 'disable_canonical_redirect_for_front_page' ) );
|
139 |
|
140 |
add_filter( 'the_content', array( $this, 'alter_faq_content' ) );
|
|
|
141 |
add_action( 'wp_footer', array( $this, 'output_ld_json_content' ) );
|
142 |
|
143 |
add_action( 'init', array( $this, 'load_view_files' ) );
|
@@ -417,6 +418,26 @@ class ewdufaqInit {
|
|
417 |
$content = do_shortcode( '[select-faq faq_id="' . $post->ID . '"]' );
|
418 |
|
419 |
$ewd_ufaq_controller->single_page_print = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
|
421 |
return $content;
|
422 |
}
|
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.12
|
10 |
WC requires at least: 3.0
|
11 |
+
WC tested up to: 6.4
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
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.12' );
|
50 |
|
51 |
define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
|
52 |
define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
|
138 |
add_filter( 'redirect_canonical', array( $this, 'disable_canonical_redirect_for_front_page' ) );
|
139 |
|
140 |
add_filter( 'the_content', array( $this, 'alter_faq_content' ) );
|
141 |
+
add_filter( 'the_content', array( $this, 'add_faqs_content' ) );
|
142 |
add_action( 'wp_footer', array( $this, 'output_ld_json_content' ) );
|
143 |
|
144 |
add_action( 'init', array( $this, 'load_view_files' ) );
|
418 |
$content = do_shortcode( '[select-faq faq_id="' . $post->ID . '"]' );
|
419 |
|
420 |
$ewd_ufaq_controller->single_page_print = false;
|
421 |
+
|
422 |
+
return $content;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Append the ultimate-faqs shortcode to a post's $content variable
|
427 |
+
* @since 2.1.12
|
428 |
+
*/
|
429 |
+
function add_faqs_content( $content ) {
|
430 |
+
global $post;
|
431 |
+
|
432 |
+
if ( ! is_main_query() || ! in_the_loop() ) {
|
433 |
+
|
434 |
+
return $content;
|
435 |
+
}
|
436 |
+
|
437 |
+
if ( $post->ID == $this->settings->get_setting( 'faq-page' ) ) {
|
438 |
+
|
439 |
+
return $content . do_shortcode( '[ultimate-faqs]' );
|
440 |
+
}
|
441 |
|
442 |
return $content;
|
443 |
}
|
@@ -715,6 +715,7 @@ class ewdufaqViewFAQ extends ewdufaqView {
|
|
715 |
*/
|
716 |
public function set_display_variables() {
|
717 |
global $post;
|
|
|
718 |
|
719 |
// Added in to get another f$*!ing page builder to work correctly
|
720 |
$post = get_post( $this->post->ID );
|
@@ -727,6 +728,12 @@ class ewdufaqViewFAQ extends ewdufaqView {
|
|
727 |
$this->faq_preview = apply_filters( 'the_content', html_entity_decode( $this->post->post_excerpt ) );
|
728 |
$this->faq_author = get_post_meta( $this->post->ID, 'EWD_UFAQ_Post_Author', true);
|
729 |
$this->date = get_the_date( '', $this->post->ID );
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
|
731 |
remove_filter( 'siteorigin_panels_filter_content_enabled', array( $this, 'disable_site_origin_page_builder' ) );
|
732 |
|
715 |
*/
|
716 |
public function set_display_variables() {
|
717 |
global $post;
|
718 |
+
global $ewd_ufaq_controller;
|
719 |
|
720 |
// Added in to get another f$*!ing page builder to work correctly
|
721 |
$post = get_post( $this->post->ID );
|
728 |
$this->faq_preview = apply_filters( 'the_content', html_entity_decode( $this->post->post_excerpt ) );
|
729 |
$this->faq_author = get_post_meta( $this->post->ID, 'EWD_UFAQ_Post_Author', true);
|
730 |
$this->date = get_the_date( '', $this->post->ID );
|
731 |
+
|
732 |
+
if ( ! empty( $this->search_string ) and $ewd_ufaq_controller->settings->get_setting( 'highlight-search-term' ) ) {
|
733 |
+
|
734 |
+
$this->faq_title = preg_replace( '/\b(' . $this->search_string . ')\b/i', '<span class="ewd-ufaq-highlight-search-term">$0</span>', $this->faq_title );
|
735 |
+
$this->faq_answer = preg_replace( '/\b(' . $this->search_string . ')\b/i', '<span class="ewd-ufaq-highlight-search-term">$0</span>', $this->faq_answer );
|
736 |
+
}
|
737 |
|
738 |
remove_filter( 'siteorigin_panels_filter_content_enabled', array( $this, 'disable_site_origin_page_builder' ) );
|
739 |
|
@@ -52,7 +52,7 @@ class ewdufaqViewFAQSearch extends ewdufaqViewFAQs {
|
|
52 |
$output = $this->replace_list_header( $output );
|
53 |
}
|
54 |
|
55 |
-
return apply_filters( '
|
56 |
}
|
57 |
|
58 |
/**
|
@@ -63,7 +63,7 @@ class ewdufaqViewFAQSearch extends ewdufaqViewFAQs {
|
|
63 |
|
64 |
if ( $this->show_on_load ) { return; }
|
65 |
|
66 |
-
$template = $this->find_template( '
|
67 |
if ( $template ) {
|
68 |
include( $template );
|
69 |
}
|
52 |
$output = $this->replace_list_header( $output );
|
53 |
}
|
54 |
|
55 |
+
return apply_filters( 'ewd_ufaq_search_faqs_output', $output, $this );
|
56 |
}
|
57 |
|
58 |
/**
|
63 |
|
64 |
if ( $this->show_on_load ) { return; }
|
65 |
|
66 |
+
$template = $this->find_template( 'faqs-shortcode-args' );
|
67 |
if ( $template ) {
|
68 |
include( $template );
|
69 |
}
|
@@ -25,6 +25,8 @@ class ewdufaqViewFAQs extends ewdufaqView {
|
|
25 |
// Array containing IDs of categories to not display, empty if all should be displayed
|
26 |
public $exclude_categories = array();
|
27 |
|
|
|
|
|
28 |
/**
|
29 |
* Define the the FAQs to be used
|
30 |
*
|
@@ -41,7 +43,8 @@ class ewdufaqViewFAQs extends ewdufaqView {
|
|
41 |
if ( get_class( $faq ) != 'ewdufaqFAQ' ) { continue; }
|
42 |
|
43 |
$faq->is_search = ! empty( $this->is_search ) ? true : false;
|
44 |
-
|
|
|
45 |
$faq_view = new ewdufaqViewFAQ( $faq );
|
46 |
|
47 |
$this->faqs[] = $faq_view;
|
25 |
// Array containing IDs of categories to not display, empty if all should be displayed
|
26 |
public $exclude_categories = array();
|
27 |
|
28 |
+
public $show_on_load = '';
|
29 |
+
|
30 |
/**
|
31 |
* Define the the FAQs to be used
|
32 |
*
|
43 |
if ( get_class( $faq ) != 'ewdufaqFAQ' ) { continue; }
|
44 |
|
45 |
$faq->is_search = ! empty( $this->is_search ) ? true : false;
|
46 |
+
$faq->search_string = ! empty( $this->search_string ) ? $this->search_string : '';
|
47 |
+
|
48 |
$faq_view = new ewdufaqViewFAQ( $faq );
|
49 |
|
50 |
$this->faqs[] = $faq_view;
|