• The issue seems to be related to AJAX loading when the remaining posts are less than 10. The Page loads 10 posts at a time and if there are 12 posts total then pressing the load more button rightly disapears but the remaining 2 posts do not load.

    If there were 24 post results then our page will sucessfully load the first and second page using the load more button, but will not load the final 4 posts.

    The problem may be arising from the way AJAX is interacting with the WordPress query.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Is this a Relevanssi problem? Does this go away if you disable Relevanssi?

    I tried looking at your site, but it doesn’t have a “load more” button, just regular paging which seems to be working fine.

    Thread Starter tomo55555

    (@tomo55555)

    Yes, if I unistall the plugin the results return to normal, albeit without the ACF results. I have switched the pagination back to ajax load more for you to test.

    By the way I have been researching the theme code and it looks like the original ajax search is provided by SearchWP Live Ajax Search. I can’t be 100% sure, but this may be conflicting with your plugin.

    Thanks,

    Ian

    Plugin Author Mikko Saari

    (@msaari)

    SearchWP Live Ajax search used to be compatible with Relevanssi, but I’m not sure if it is anymore.

    In any case, your “Load more” button does a perfectly normal search query. With the “handle” query it also seems to work correctly: I got all 33 posts out of it.

    Is there a search that would demonstrate this not working?

    Thread Starter tomo55555

    (@tomo55555)

    Hi Mikko,

    Thanks for checking. If you follow this search url you’ll see a restricted search to only a particular category id: https://buildreview.org/?s=handle&search_cat=686

    I basically wrote a separate code snippet that used your relevanssi_modify_wp_query to reduce the search results to a particular category and that’s when the ajax issue started. I can send you the code but I suspect that it’s a bigger issue than your support allows for on the free version. Saying that though, is there an easy way to create a search form that I can just use as a sidebar widget and using the standard search results template?

    Sorry for the confusion, I thought the ajax issue was for the full site search as well.

    Many thanks.

    Plugin Author Mikko Saari

    (@msaari)

    Looks like the “Load more” query doesn’t include the category parameter. That may be related. Despite missing the parameter, it still returns a null result. It’s weird, but I can’t really say this or that without knowing what happens under the hood.

    The easiest way to create a search form is the [searchform] shortcode.

    Thread Starter tomo55555

    (@tomo55555)

    Hi Mikko,

    Thanks for your help. May I ask, is there a search string that I can use to use the shortcode and then restrict the answers to a particular parent category and its siblings?

    Thanks,

    Plugin Author Mikko Saari

    (@msaari)

    You can add query parameters to the shortcode. [searchform cats="68"]?would create a shortcode that searches only that category.

    If you want a search form that reads in the category restriction from the query parameters, that’s also possible, but requires PHP code in the search form. You can’t do that with the shortcode alone.

    Thread Starter tomo55555

    (@tomo55555)

    That’s great, that works really well. Thank you!

    So last question from New Zealand for today is, can we use ajax load more with this form search results? I get the standard wordpress page number pagination.

    I did load your Relevanssi Live Ajax Search plugin to see if they work together but no change, so perhaps there’s a config setting???

    Thanks again for your time, it’s really appreciated.

    Plugin Author Mikko Saari

    (@msaari)

    You can use ajax load more, it just depends on what the load more exactly does. The load more implementation needs to pick up the query parameters from the query string and pass them to the search query. That seems like a very basic feature.

    Plugin Author Mikko Saari

    (@msaari)

    The search form is irrelevant to the load more; those two parts are not really connected.

    Thread Starter tomo55555

    (@tomo55555)

    ok, I uninstalled your ajax live search because it didn’t really work with this search form. But that’s not important.

    However, I did use your shortcode [searchform cats=”686″] and tested it with the word “handle” on our development site: https://dev.buildreview.org/test-search-form/

    If you type in the word HANDLE you should get 12 posts. But when I use the LOAD MORE ajax button the results get pulled from the entire site again. Any thoughts why this might be happening please?

    Plugin Author Mikko Saari

    (@msaari)

    The load more does not read the category parameter. You can try using cat instead of cats in the shortcode; cats is specific to Relevanssi. If using cat does not help, then you need to fix the load more so that it checks the query parameters from the query and uses them.

    Thread Starter tomo55555

    (@tomo55555)

    OK, tried cat and that does not fix the issue. I’ll research more into why the theme developer used SearchWP Live Ajax Search and see if I can roll it out and find another ajax load more solution. Again, thanks for your help.

    Plugin Author Mikko Saari

    (@msaari)

    Ajax Load More works with Relevanssi, that much I know.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Ajax ‘Read More’ Problem’ is closed to new replies.