Getting value from url

Forums › Forums › Search & Filter Pro › Getting value from url

Viewing 10 posts – 1 through 10 (of 46 total)
  • Anonymous
    #51786

    Hello,

    I would like to get a part of the url that S&F creates to dynamically fill my ACF so that the price corresponds with the selected options. Is this possible?

    For example the url is:
    sft_arrangementstype=dineren+italiaans-menu

    And I’d like to get the part that has dineren and italiaans-menu.

    Trevor
    #51797

    You need to check this pages out:

    http://www.designsandcode.com/documentation/search-filter-pro/action-filter-reference/

    If a function looks about right, search the forum for threads that might show examples.

    Anonymous
    #51817

    Hello Trevor,
    This looks like a script that would work, I guess.
    How do I use this?

    function filter_function_name($input_object, $sfid)
    {
    	if($input_object['name']=='_my_field_name')
    	{
    		//udpate this field before rendering
    	}
    	
    	return $input_object;
    }
    add_filter('sf_input_object_pre', 'filter_function_name', 10, 2);
    Anonymous
    #51818

    Could you please explain or point me in the right direction?

    Trevor
    #51819

    It is placed within your them functions.php file. Hopefully, you are using a child theme, so it would in the functions.php file of that. functions.php is run before very page load by all WP Themes.

    Here is an example posted by the developer:

    https://gist.github.com/rmorse/7b59b45a14b1ca179868

    Anonymous
    #51821

    So, that’s way over my head.
    Maybe this is a simpler question, I’ve searched the forms, couldn’t find any answers.

    How do I echo the checked=”checked” values?

    this and similar codes don’t do the trick.

    <?php if( isset($_POST['_sft_arrangementstype']) && is_array($_POST['_sft_arrangementstype']) ) {
        foreach($_POST['_sft_arrangementstype'] as $fruit) {
            // eg. "I have a grapefruit!"
            echo "I have a {$fruit}!";
            // -- insert into database call might go here
        }
    
        // eg. "apple, grapefruit"
        $fruitList = implode(', ', $_POST['_sft_arrangementstype']);
        // -- insert into database call (for fruitList) might go here.
    }?>
    Trevor
    #51829
    Anonymous
    #51831

    Hi Trevor,
    Thanks I’ve got the code to echo the values. But (I think) because I’m using “As Shortcode” as a display option my echo’s don’t get updated?

    So I have to refresh the page to update the echo’s. Any way I can fix this?

    Trevor
    #51840

    Are you using Ajax?

    Anonymous
    #51885

    Yes, I’m using Ajax.

    $( document ).ajaxStart(function() {
      $( ".things" ).refresh();
    });

    I should probably do a ajaxStart but how? .things is my test div class for now.

Viewing 10 posts – 1 through 10 (of 46 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.