Forums › Forums › Search & Filter Pro › Load More ajax functionality stopped working after updating plugin.
- This topic has 17 replies, 3 voices, and was last updated 4 years ago by Ross.
-
Anonymous(Private) November 23, 2020 at 6:32 pm #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(Private) November 24, 2020 at 12:21 pm #267582How 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(Private) November 24, 2020 at 9:42 pm #267709The 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(Private) November 26, 2020 at 10:56 am #267903Hi 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(Private) November 29, 2020 at 5:55 pm #268133Hey 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(Private) November 30, 2020 at 4:33 pm #268256This reply has been marked as private.Ross Moderator(Private) November 30, 2020 at 5:09 pm #268277This reply has been marked as private.Ross Moderator(Private) December 4, 2020 at 12:18 pm #268809This reply has been marked as private. -
AuthorPosts