Home › Forums › Pro Support › WPSP Custom Ajax request
- This topic has 6 replies, 2 voices, and was last updated 4 years, 4 months ago by
Tom.
-
AuthorPosts
-
May 22, 2019 at 9:01 pm #9486
sebastien
ParticipantHi,
I use GMW to displays some maps, one of their futures is “Filtering” pins displayed on their map.
My plan is to link GMW and WPSP.I would like to be able to use GMW like “Filter” to refresh the request of WPSP
It would be so nice to be able to param dynamicly with ajax (like using filters) the content of WPSP.
For example: Change/add some ID or TAG Filters of POSTS we want to display.I’m working with GMW to the other side of the function: trigger the AJAX Custom Request by clicking on their Filters / Pins.
My question is: Is WPSP the good candidat? =)
Thanks for any information !
May 23, 2019 at 1:32 am #9488sebastien
ParticipantThe aim is so to build an dynamic filter (ajax).
Do you think this is the good way to accomplish it:
* Post: use filter to change values of inc/defaults.php for a selected WPSP list
* Get: then use this value to launch an ajax request to “refresh” theDo you have any exemple of this kind of need?
thanks
May 23, 2019 at 4:18 pm #9504Tom
KeymasterHi there,
As of right now this isn’t possible without some custom development.
It is something we want to add to the pro version soon.
May 23, 2019 at 10:48 pm #9509sebastien
ParticipantOk thanks, you have any ETA for the next version? days, weeks, months?
May 24, 2019 at 8:00 am #9518sebastien
ParticipantDoes it mean you’re going to implement some filters? as searchandfilter does? is it on your road map?
I would not buy this plugin if I know you’re going to do the same thing..May 24, 2019 at 5:59 pm #9527Tom
KeymasterThere is no timeline for this specific feature. It’s something I want to add in the next major version, but we haven’t started development on that yet.
May 24, 2019 at 6:08 pm #9530Tom
KeymasterHere’s one way you might be able to achieve something like this.
Add the following functions:
add_action( 'wpsp_inside_wrapper', function( $settings ) { if ( count( $settings[ 'tax_term' ] ) > 0 ) { echo '<select class="drop-filter"><option value="all">All</option>'; $cnt = sort( $settings[ 'tax_term' ] ); foreach ( $settings[ 'tax_term' ] as $trm ) { echo '<option value="' . $trm . '">' . str_replace( '-',' ',$trm ) . '</option>'; } echo '</select>'; } } ); add_action( 'wp_footer', function() { ?> jQuery( document ).ready( function( $ ) { $( ".drop-filter" ).change( function() { var selectedOption = $( this ).children( "option:selected" ).val(); if ( 'all' === selectedOption ) { $( '.wp-show-posts-single' ).fadeIn( 100 ); } else { $( '.wp-show-posts-single' ).fadeOut( 100 ); $( '.location-' + selectedOption ).fadeIn( 100 ); } } ); }); <?php } );
The only change you need to make is this line:
$( '.location-' + selectedOption ).fadeIn( 100 );
location
is the taxonomy – so you’d need to update that with whatever taxonomy slug you’re using. -
AuthorPosts
- You must be logged in to reply to this topic.