Forums Forums Search & Filter Pro Getting value from url

Viewing 10 posts - 11 through 20 (of 46 total)
  • Trevor
    #51890

    The first part of our FAQ page gives some ideas:

    https://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/

    Anonymous
    #51891

    Trevor, 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");
    });
    Trevor
    #51892

    I am probably only a bit more so than you.

    This part:

    //so load your lightbox or JS scripts here again

    you would probably put your

    $( ".things" ).refresh();

    Anonymous
    #51893

    I get this error right now…
    TypeError: $(...).refresh is not a function

    Trevor
    #51894

    I took the refresh from the code you posted. I assumed you had written a function to do this.

    Anonymous
    #51895

    Nope. Like I said, not a coder 🙂 Sorry for the misunderstanding/confusion.

    Trevor
    #51896

    Ah, well, you will need to revert to scouring stackoverflow with ways to re-populate an element using jQuery. This falls well outside of what I would term normal technical support. And beyond my skill set.

    Anonymous
    #51898

    Hi 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?

    Trevor
    #51931

    Do you know what part of your code actually outputs the text right now?

    Anonymous
    #51933

    Hi 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.

Viewing 10 posts - 11 through 20 (of 46 total)