Forums › Forums › Search & Filter Pro › Getting value from url
- This topic has 45 replies, 2 voices, and was last updated 8 years, 3 months ago by Anonymous.
-
Trevor(Private) July 22, 2016 at 8:42 am #51890
The first part of our FAQ page gives some ideas:
https://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/
Anonymous(Private) July 22, 2016 at 8:52 am #51891Trevor, could you please help me with the code? I’m more of a Front-ender not a coder. I think you mean this script right?
//detects the start of an ajax request being made $(document).on("sf:ajaxstart", ".searchandfilter", function(){ console.log("ajax start"); }); //detects when the ajax request has finished and the content has been updated // - add scripts that apply to your results here $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); });
Anonymous(Private) July 22, 2016 at 9:41 am #51898Hi Trevor, I got it to work.
Using this code:function refresh() { $('.things').load(document.URL + ' .things'); } //detects the start of an ajax request being made $(document).on("sf:ajaxstart", ".searchandfilter", function(){ console.log("ajax start"); }); //detects when the ajax request has finished and the content has been updated // - add scripts that apply to your results here $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again refresh(); }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); });
The only thing is, it posts the whole category and name: Aantal personen: 20 of meer personen. You’ve already tackelled this problem here: https://support.searchandfilter.com/forums/topic/how-to-style-the-search-data/
global $searchandfilter; $sf_current_query = $searchandfilter->get(339)->current_query()->get_array(); foreach($sf_current_query as $key) { echo '<div>' . $key['active_terms'][0]['name'] . '</div>'; }
Which would display “20 of meer personen” but What I would like is to have it show “Aantal personen:<br />20 of meer personen.
What to do?
Anonymous(Private) July 22, 2016 at 3:16 pm #51933Hi Trevor,
I think it’s this part:
<?php //Get a multiple fields values by passing an array of field names //replace 1526 with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(15)->current_query(); ?> <?php $arrangement = $sf_current_query->get_fields_html(array("_sft_aantal_personen","_sft_arrangementstype","_sft_type_boot"), array('show_all_if_empty' => false)); ?>
I like to keep my echo’s separate from the rest… so I can echo them where ever I like.
-
AuthorPosts