From de60c363e3fd17cf1233a2973523571c879d9d35 Mon Sep 17 00:00:00 2001 From: jorge-vitrubio Date: Fri, 13 Jan 2023 20:23:42 +0100 Subject: [PATCH] form filter based on jQuery works for archive-ajut.php category --- ...stom-field-ajuts-filter-function-frontend.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/includes/custom-field-ajuts-filter-function-frontend.php b/includes/custom-field-ajuts-filter-function-frontend.php index 8b7e79d..96dafd3 100644 --- a/includes/custom-field-ajuts-filter-function-frontend.php +++ b/includes/custom-field-ajuts-filter-function-frontend.php @@ -79,8 +79,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ): -

Results:

- +

';?> +

enviar

@@ -95,7 +95,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ): (function($) { // change - $('#archive-filters').on('click', 'button', function(){ + //$('#archive-filters').on('click', 'button', function(){ + $('#archive-filters').on('click', 'input', function(){ // vars var url = ''; @@ -139,6 +140,8 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ): }; }); + // remove last ',' + valueschecked = valueschecked.slice(0, -1); // save last cycled filtered value already calculated field=val01,val02,val03 appendtoURL += eachfiltered +'=' +valueschecked +'&'; @@ -147,8 +150,13 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form' ) ): // update url url += '?' +appendtoURL; + + // show or modify the url + //alert( url ); + //$('#filterlink').text(url); - alert( url ); + // convert a href url to new value + $('#submitfilteredlink').attr('href',url); });