Load More ajax functionality stopped working after updating plugin.

Forums › Forums › Search & Filter Pro › Load More ajax functionality stopped working after updating plugin.

Tagged: ,

Viewing 10 posts – 1 through 10 (of 18 total)
  • Anonymous
    #267557

    Hey Trevor!

    I just launched a site that is using Search Filter Pro here: https://mcclone.net/portfolio/ I’m using the shortcode method with a custom template for results. Note there is a “load more” button that ajaxes in additional results below the initial set of results.

    This quit working when I updated your plugin to v 2.5.2. I fixed by rolling the plugin back to v 2.5.1.

    I have the initial staged site here: https://mccloneconstruction.wp-goodness.com/portfolio/ – and have the updated plugin in place. As you’ll see the load more button has quit working. It advances to the next page of results, instead of ajaxing content in. I thought all ajax was broken at first, because the filtered results were showing new URLs – but then I remembered I had this turned on for bookmarking and verified the results were ajaxing in. So sorry for my misstatement on an earlier thread that ajax was completely broken.

    I understand this is custom functionality, but am hoping you can help me pinpoint the issue. What in the update could have broken this?

    Thanks!

    Trevor
    #267582

    How did you get a load more function to work? As you know, we don’t support that. It looks like it is in the theme?

    I notice that, when hovering over the Load More button, the URL looks different, for example:

    https://mccloneconstruction.wp-goodness.com/portfolio/?lang=en&sf_paged=3

    It has ?lang=en& in it, which suggests a translation plugin is involved. Do you have something like WPML or Polylang installed?

    I may need to refer this to our plugin developer, Ross, for his attention.

    Anonymous
    #267709

    The load more functionality is just a script that I added to the bottom of our template override. Here is the complete code within our file at theme-name/search-filter/results.php

    <?php
    /**
     * Search & Filter Pro Template Part
     * Results Template Override
     * @package Search_Filter
     */
    
    if ( $query->have_posts() ) { ?>
    
    	<div class="wpgood-filtered-portfolio">
    	
    		<?php while ( $query->have_posts() ) { $query->the_post(); ?>
    
    			<article class="wpgood-portfolio">
    
    				<a class="wpgood-portfolio-link" href="<?php the_permalink(); ?>">
    
    					<?php if ( has_post_thumbnail() ) {
    
    							the_post_thumbnail( 'portolio-thumb' );
    
    					} ?>
    
    					<h3><?php the_title(); ?></h3>
    				
    				</a>
    				
    			</article>
    			
    		<?php } ?>
    		
    		<div class="pagination">
    			
    			<div class="nav-previous">
    
    				<?php next_posts_link( 'Load More', $query->max_num_pages ); ?>
    
    			</div>
    
    		</div>
    
    		<div class="wpgood-load-more"></div>
    
    	</div>
    
    <?php } else {
    
    	echo '<p class="wpgood-filtered-portfolio wpgood-no-results">No Results Found</p>';
    
    } ?>
    
    <script>
    	jQuery( document ).ready( function($) {
    		// Load more functionality
    		$( document ).on( 'click', '.wpgood-filtered-portfolio .pagination a', function(e) {
    			e.preventDefault();
    			var targetURL = $( this ).attr( 'href' );
    			$( '.wpgood-load-more:last' ).load( targetURL + ' .wpgood-filtered-portfolio' );
    			$( '.wpgood-filtered-portfolio .pagination a:first' ).remove();
    		} );
    	});
    </script>

    We’re not using any translation plugins and keep our plugin list pretty lean. We do use Yoast and have readability analysis enabled. I know I get constant Yoast nags about writing in various languages, so maybe(?) what you’re seeing comes from that? But I don’t think this should make a difference. My js grabs whichever url is most recently served.

    Looking forward to your thoughts and am happy to share an admin login, if it helps.

    Thanks again!

    Ross Moderator
    #267903

    Hi Tricia

    I’m having a look, and it seems that the Load More is working again? (or did you just revert to an older version?)

    I don’t see why one version would work and not the other. Can you tell me what version you upgraded from -> to?

    Thanks

    Anonymous
    #268133

    Hey Ross

    The load more is working on the live site – running v 2.5.1 – here: https://mcclone.net/portfolio/

    The original staging site is not working and is running 2.5.2. I have this site up until we can resolve our conflict and will update the live site then: https://mccloneconstruction.wp-goodness.com/portfolio/

    Hope this helps.

    Thanks!

    Ross Moderator
    #268256
    This reply has been marked as private.
    Anonymous
    #268264
    This reply has been marked as private.
    Ross Moderator
    #268277
    This reply has been marked as private.
    Anonymous
    #268284
    This reply has been marked as private.
    Ross Moderator
    #268809
    This reply has been marked as private.
Viewing 10 posts – 1 through 10 (of 18 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.