The forums are closed and will be removed when we launch our new site.
Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › Problem with ajax results missing audio player
Tagged: ACF and SF
- This topic has 11 replies, 4 voices, and was last updated 7 years, 1 month ago by Fischer Emmanuel.
-
Adrian Jefferies(Private) April 2, 2015 at 6:27 pm #14438
Hi Ross,
I’ve got an issue that I need some help with please. I am using Search and Filter Pro to filter bible talks in a number of ways. When all the talks are listed using a template file, the audio player displays under each talk, as expected.
If I then go to filter the talks by say “preacher”, then the list updates fine, showing only talks by that speaker, but the audio player does not show. It loads onto the page, but does not display on screen.
Furthermore, if I refresh the page, the audio players load in, but the title of the page changes to Blog.
The issue is seen here:
http://kfc.definingdesign.co.uk/sermons/ – choose some way of filtering using the “sermon sorter” on the right, then refresh the page.Any help very gratefully received.
Ross Moderator(Private) April 2, 2015 at 6:49 pm #14444Hi Adrian
What is happening is, when the page loads, your theme is doing all kinds of stuff like loading the scripts for your audio player and attaching them to the page.
Then, once you use ajax, these audio player are removed, and new results are brought in. However this scenario is different because your theme doesn’t run the scripts it needs to setup those audio players.
Take a look at the first question here:
http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/Basically you need to run the same scripts (for setting up audio players) that your theme runs when ajax has finished loading – your theme developer may know of some functions that could do this.
Thanks
Adrian Jefferies(Private) April 2, 2015 at 7:31 pm #14457Hi Ross,
Thanks for the quick reply. The FAQ helped a lot, and I just added the following into my .js file and it works great:
$(“.searchandfilter”).on(“sf:ajaxfinish”,function(){
$(‘video,audio’).mediaelementplayer();
});Users should not need to refresh the page, but if they do, the title of the page still changes to “Blog | Site Title”
Any further suggestions?
Ross Moderator(Private) April 2, 2015 at 8:22 pm #14462check out this thread 😉
https://support.searchandfilter.com/forums/topic/change-page-title-for-search-results/
Adrian Jefferies(Private) April 2, 2015 at 8:43 pm #14464Thanks Ross – spot on. You are a patient man.
Here is the code I used in functions.php:
add_filter('wpseo_title','search_meta_title'); function search_meta_title($data){ global $sf_form_data; if($sf_form_data->form_id()==1272) { return 'Sermons'; } else { return $data; } }
Fischer Emmanuel(Private) August 22, 2017 at 8:27 am #127088Hello, I have the same problem with my audio player that changes shape and color once the rescheerche display. I see you say you have to put in the js:
$ ( “Searchandfilter.”) One (“sf: ajaxfinish.”, Function () {
$ (‘Video, audio’) mediaelementplayer ().
});
But where exactly? This is serach-filter-build.js?
cordiallyAdrian Jefferies(Private) August 22, 2017 at 9:41 am #127103I put it in a separate .js file that is registered using wp_register_script and queued using wp_enqueue_script within functions.php in the usual way.
Note your code is wrong in a number of ways. It should be:
$(".searchandfilter").on("sf:ajaxfinish",function(){ $('video,audio').mediaelementplayer(); });
Fischer Emmanuel(Private) August 22, 2017 at 10:59 am #127108Hello, thank you for your answer. But since I am a beginner, I did not understand the manipulation … Thank you for your patience.
Trevor Moderator(Private) August 22, 2017 at 11:13 am #127111If you are placing that code inline on the page, it would become like this:
<script>(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); $('video,audio').mediaelementplayer(); }); }(jQuery));</script>
-
AuthorPosts
The topic ‘Problem with ajax results missing audio player’ is closed to new replies.