Forums › Forums › Search & Filter Pro › Update "found posts"
- This topic has 10 replies, 2 voices, and was last updated 7 years ago by
Anonymous.
-
Anonymous(Private) February 15, 2018 at 7:49 pm #160020
Hi,
I would like to put this function outside of
results.php
to place it in a particular place:
Found <?php echo $query->found_posts; ?> Results
But that does not work (normal).
It works if I slightly chance the function:
Found <?php echo $wp_query->found_posts; ?> Results
But it does not update when searching (Ajax).
Is there a way to make it work?
Thanks in advance.
Trevor(Private) February 16, 2018 at 7:28 am #160149Ajax only updates part of your page. Anything inside the container that it updates will change, but you may have inserted the count outside that container. In the shortcode method, what is inside results.php gets refreshed, what is outside does not.
Trevor(Private) February 16, 2018 at 9:01 am #160163You COULD use this function, by adding your own javascript to alter other parts of the page:
<script>(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); // load your code here }); }(jQuery));</script>
This will trigger every time our Ajax call is run.
-
AuthorPosts