[Support request] WPSP Custom Ajax request

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support WPSP Custom Ajax request

This topic contains 6 replies, has 2 voices, and was last updated by  Tom 6 months, 2 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9486

    sebastien
    Participant

    Hi,

    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 !

    #9488

    sebastien
    Participant

    The 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” the

    Do you have any exemple of this kind of need?

    thanks

    #9504

    Tom
    Keymaster

    Hi 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.

    #9509

    sebastien
    Participant

    Ok thanks, you have any ETA for the next version? days, weeks, months?

    #9518

    sebastien
    Participant

    Does 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..

    #9527

    Tom
    Keymaster

    There 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.

    #9530

    Tom
    Keymaster

    Here’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.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.