• Resolved Venci

    (@fabrixweb)


    Hi,

    Is there a way to Pass 2 or more values from XML to PHP function in Function Editor?
    What I am trying to achieve is:

    IF {field_one[1]} OR {field_two[1]} contains a specific word then do something.

    I did it with one field and it works. The code is

    function myfunction ($field_one) {
    	//Some code
    	}

    And then in the text editor I placed this one: [myfunction({field_one[1]})]

    So what I need is something like this:
    [myfunction({field_one[1]}, {field_two[1]})]
    and then pass this two values to the PHP function.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @fabrixweb

    Yes, you can pass both fields to the function like so:

    [myfunction({field_one[1]}, {field_two[1]})]

    And, your function would look something like this:

    function myfunction( $field_one, $field_two ) {
        // Do something with $field_one and $field_two
    }
    Thread Starter Venci

    (@fabrixweb)

    Thank you very much. I will try.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to: Pass 2 values from XML to PHP function’ is closed to new replies.